So I need to get a List
from my enum
Here is what I have done so far:
enum definition
This generic static method works fine for getting a list of descriptions for each value of an enum type of T:
public static IEnumerable GetDescriptions()
{
var attributes = typeof(T).GetMembers()
.SelectMany(member => member.GetCustomAttributes(typeof (DescriptionAttribute), true).Cast())
.ToList();
return attributes.Select(x => x.Description);
}