Extension method for getting enum items description Make sure each enum item has System.ComponentModel.DataAnnotations.DisplayAttribute. eg [System.ComponentModel.DataAnnotations.Display(Name = "Email Contact", Description = "Email Contact from the Contact Editor / Viewer")] if the enum item doesn't have the attribute, an empty string is returned.

Namespace: Contracts
Assembly: Contracts (in Contracts.dll)

<Extension()> _ 
Public Shared Function GetDescription( _ 
ByVal value As Enum
) As String
This language is not supported or no code example is available.
public static string GetDescription( 
this Enum value 
)
This language is not supported or no code example is available.
[Extension()] 
public:  
static String^ GetDescription( 
Enum^ value 
)
This language is not supported or no code example is available.
public  
Extension() 
static function GetDescription( 
value : Enum 
) : String;
This language is not supported or no code example is available.

Parameters

value
Type: Enum

<default>

Return Value

Type: string

.NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1