Click or drag to resize
EnumParse Method (Type, String, Boolean)
Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. A parameter specifies whether the operation is case-insensitive.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static Object Parse(
	Type enumType,
	string value,
	bool ignoreCase
)

Parameters

enumType
Type: SystemType
An enumeration type.
value
Type: SystemString
A string containing the name or value to convert.
ignoreCase
Type: SystemBoolean
true to ignore case; false to regard case.

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