fCraft  0.638
Custom Minecraft Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events
fCraft.EnumUtil Class Reference

Provides TryParse method, for parsing enumerations. More...

Static Public Member Functions

static bool TryParse< TEnum > ([NotNull] string value, out TEnum output, bool ignoreCase)
 Tries to parse a given value as an enumeration. Even if value is numeric, this method still ensures that given number is among the enumerated constants. This differs in behavior from Enum.Parse, which accepts any valid numeric string (that fits into enumeration's base type).
 

Detailed Description

Provides TryParse method, for parsing enumerations.

Member Function Documentation

static bool fCraft.EnumUtil.TryParse< TEnum > ( [NotNull] string  value,
out TEnum  output,
bool  ignoreCase 
)
static

Tries to parse a given value as an enumeration. Even if value is numeric, this method still ensures that given number is among the enumerated constants. This differs in behavior from Enum.Parse, which accepts any valid numeric string (that fits into enumeration's base type).

Template Parameters
TEnumEnumeration type.
Parameters
valueRaw string value to parse.
outputParsed enumeration to output. Set to default(TEnum) on failure.
ignoreCaseWhether parsing should be case-insensitive.
Returns
Whether parsing succeeded.
Exceptions
ArgumentNullExceptionvalue is null.

The documentation for this class was generated from the following file: