Mono Class Library: System.Enum Overview | Members

System.Enum.Parse Method

Converts the specified string representation of one or more enumerated constants of a specified enumeration type to an equivalent enumerated object. This method behaves in a case-sensitive or insensitive manner according to the specified bool.

[System.Runtime.InteropServices.ComVisible(true)]
public static object Parse (Type enumType, string value, bool ignoreCase)

Parameters

enumType
The Type of an enumeration.
value
A string containing one or more names or a single numeric value to convert. If the string contains more than one name, each name is required to be separated by a comma (','). The names or number can be surrounded by any amount of white space.
ignoreCase
A bool value. Specify true to have names in value parsed in a case-insensitive manner. Specify false to have names parsed in a case-sensitive manner.
ignoreCase
Documentation for this section has not yet been entered.

Returns

A object of type enumType whose values are represented by value.

Exceptions

TypeReason
ArgumentNullExceptionenumType or value is a null reference.
ArgumentException

enumType is not a Type that describes a Enum.

-or-

value is either equal to string.Empty or contains only white space.

-or-

value represents one or more names, and at least one name represented by value is not of type enumType.

Remarks

Documentation for this section has not yet been entered.

Example

For an example that demonstrates parsing strings containing enumeration values, see Enum.Parse(Type, string)(Type, string).

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0