Click or drag to resize
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: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
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: Object
An object of type enumType whose value is represented by value.
Exceptions
ExceptionCondition
ArgumentNullExceptionenumType or value is null.
ArgumentExceptionenumType 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.
OverflowExceptionvalue is outside the range of the underlying type of enumType.
See Also