I want to implement an extension method which converts an enum to a dictionary:
public static Dictionary ToDictionary(this Enum @enum) {
Jon Skeet has written everything you need ;)
But here you have your code that is working:
public static Dictionary ToDictionary(this Enum @enum) { var type = @enum.GetType(); return Enum.GetValues(type).Cast().ToDictionary(e => e, e => Enum.GetName(type, e)); }