My question is best illustrated with an example.
Suppose I have the enum:
public enum ArrowDirection
{
North,
South,
East,
West
}
using System.ComponentModel;
using System.Reflection;
public enum ArrowDirection
{
[Description("Northwards")]
North,
[Description("Southwards")]
South,
[Description("Eastwards")]
East,
[Description("Westwards")]
West
}
...
Create an extension method to get a list of descriptions:
public static class Enum where T : struct
{
///
/// Gets a collection of the enum value descriptions.
///
///
public static IList GetDescriptions()
{
List descriptions = new List();
foreach (object enumValue in Enum.GetValues())
{
descriptions.Add(((Enum)enumValue).ToDescription());
}
return descriptions;
}
}