asp.net.ph

Enum.GetName Method

System Namespace   Enum Class


Retrieves the name of the constant in the specified enumeration that has the specified value.

[ VB ]
<Serializable>
Public Shared Function GetName ( _
   ByVal enumType As Type, _
   ByVal value As Object _
) As String

[ C# ]
[Serializable]
public static string GetName (
   Type enumType,
   object value
);

[ C++ ]
[Serializable]
public: static String* GetName (
   Type* enumType,
   Object* value
);

[JScript ]
public Serializable
static function GetName (
   enumType : Type,
   value : Object
) : String;

Parameters

enumType
An enumeration.
value
The value of a particular enumerated constant in terms of its underlying type.

Return Value

A string containing the name of the enumerated constant in enumType whose value is value, or a null reference ( Nothing in Visual Basic ) if no such constant is found.

Exceptions


Exception Type Condition
ArgumentNullException enumType or value is a null reference ( Nothing in Visual Basic ).
ArgumentException enumType is not an Enum.

-or-

value is neither of type enumType nor does it have the same underlying type as enumType.


See Also

Enum Members Skip Navigation Links


Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note