Type.GetEnumName(Object) Method

Definition

Returns the name of the constant that has the specified value, for the current enumeration type.

public:
 virtual System::String ^ GetEnumName(System::Object ^ value);
public virtual string? GetEnumName (object value);
public virtual string GetEnumName (object value);
abstract member GetEnumName : obj -> string
override this.GetEnumName : obj -> string
Public Overridable Function GetEnumName (value As Object) As String

Parameters

value
Object

The value whose name is to be retrieved.

Returns

The name of the member of the current enumeration type that has the specified value, or null if no such constant is found.

Exceptions

The current type is not an enumeration.

-or-

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

value is null.

Applies to