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.

適用於