Type.GetEnumName(Object) Type.GetEnumName(Object) Type.GetEnumName(Object) Type.GetEnumName(Object) Method

定义

返回当前枚举类型中具有指定值的常数的名称。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);
abstract member GetEnumName : obj -> string
override this.GetEnumName : obj -> string
Public Overridable Function GetEnumName (value As Object) As String

参数

value
Object Object Object Object

要检索其名称的值。The value whose name is to be retrieved.

返回

当前枚举类型中具有指定值的成员的名称;如果未找到这样的常数,则为 nullThe name of the member of the current enumeration type that has the specified value, or null if no such constant is found.

异常

当前类型不是一个枚举。The current type is not an enumeration.

-or- value 既不是当前类型,也不具有与当前类型相同的基础类型。value is neither of the current type nor does it have the same underlying type as the current type.

适用于