Enum.GetName(Type, Object) Method is used to get the name of the constant in the specified enumeration that has the specified value.
public static string GetName (Type enumType, object value);
- enumType: It is an enumeration type.
- value: It is the value of a particular enumerated constant in terms of its underlying type.
Returns: It is a string containing the name of the enumerated constant in enumType whose value is the value or null if no such constant is found.
- ArgumentNullException: If the enumType or value is null.
- ArgumentException: If the enumType is not an Enum or value is neither of type enumType nor does it have the same underlying type as enumType.
2nd value is Cat 4th value is Monkey