Following is an Enum extension that converts it to a Dictionary:
Dictionary<Int32, String> dt = niceEnum.ToDictionary();
public static Dictionary<int, string> ToDictionary(this Enum value)
{
return Enum.GetValues(typeof(value))
.Cast<value>()
.ToDictionary(t => t.ToString(), t => (int)t );
}
Posted On:
21-Jun-2019 10:02