EnumParse Method (Type, String) |
Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static Object Parse(
Type enumType,
string value
)
Parameters
- enumType
- Type: SystemType
An enumeration type. - value
- Type: SystemString
A string containing the name or value to convert.
Return Value
Type:
ObjectAn object of type
enumType whose value is represented by
value.
Exceptions Exception | Condition |
---|
ArgumentNullException | enumType or value is null. |
ArgumentException | enumType is not an Enum.-or- value is either an empty string or only contains white space.-or- value is a name, but not one of the named constants defined for the enumeration. |
OverflowException | value is outside the range of the underlying type of enumType. |
See Also