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. [Edit]

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

Parameters

enumType
The Type of an enumeration. [Edit]
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. [Edit]
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. [Edit]
ignoreCase
Documentation for this section has not yet been entered. [Edit]

Returns

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

Exceptions

TypeReason
ArgumentNullExceptionenumType or value is a null reference. [Edit]
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.

[Edit]

Remarks

Documentation for this section has not yet been entered. [Edit]

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