using System.Collections.Generic;
public static class Extensions
public static Dictionary<string, int> ToDictionary(this Type source)
throw new ArgumentException("Type must be an enumeration.");
return Enum.GetValues(source).Cast<int>().ToDictionary(value => Enum.GetName(source, value));
public static void Main()
Console.WriteLine(typeof(Test).ToDictionary());