EnumExtensionsGetNameTEnum Method

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

Definition

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

Parameters

value  TEnum
The enum value whose name is required.

Type Parameters

TEnum
The type of the enum value.

Return Value

String
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