Enum to Dictionary in C#

Try:

var dict = Enum.GetValues(typeof(fooEnumType))
               .Cast<fooEnumType>()
               .ToDictionary(t => (int)t, t => t.ToString() );

Leave a Comment