Documentation for the C# command-line option parsing library

EnumDescriptorReader.GetEnumFieldDescription Method 

Get the field description for the enumeration value

public static string GetEnumFieldDescription(
   Enum val
);

Parameters

val
The enumeration value to get the description of

Return Value

The description, or if it has none, the name

Example

Enumeration:

public enum ExampleEnum
{
[EnumDescription("This is the first value")]
FirstValue = 1,
[EnumDescription("This is the second value")]
SecondValue = 2
}
Usage:
string desc = EnumDescriptorReader.GetEnumFieldDescription(ExampleEnum.FirstValue);

See Also

EnumDescriptorReader Class | CommandLine.OptParse Namespace