EnumExtensionsGetNameTEnum Method

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


Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.1.0
public static string? GetName<TEnum>(
	this TEnum value
where TEnum : struct, new()


value  TEnum
The enum value whose name is required.

Type Parameters

The type of the enum value.

Return Value

A string containing the name of the enumerated value, or if no such constant is found.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type TEnum. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also