Casting an Enumeration with Descriptions into a Dictionary The Enumeration in question is based on int, so the following Extension returns a Dictionary&lt;int, string&gt; of the Enum's Value and Description.

Is there a cleaner way of implementing this?

public enum TeamDepartments
{
    [Description("Geschäftsleitung")] Management = 1,
    [Description("Verkaufsleitung")] Sales = 2
}

public static class UtilityExtensions
{
    public static Dictionary&lt;int, string&gt; ToDictionary(this Type EnumerationType)
    {
        Dictionary&lt;int, string&gt; RetVal = new Dictionary&lt;int,string&gt;();
        var AllItems = Enum.GetValues(EnumerationType);
        foreach (var CurrentItem in AllItems)
        {
            DescriptionAttribute[] DescAttribute = (DescriptionAttribute[])EnumerationType.GetField(CurrentItem.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
            string Description = DescAttribute.Length &gt; 0 ? DescAttribute[0].Description : CurrentItem.ToString();
            RetVal.Add((int)CurrentItem, Description);
        }
        return RetVal;
    }
}
I have this class in my code which is very similar to what you are looking for:

public static class EnumHelper {
    public static string GetRealName(this Enum value) {
        if (value == null) {
            throw new ArgumentException("value");
        }

        string name = value.ToString();
        var fieldInfo = value.GetType().GetField(name);
        if (fieldInfo == null) return "";
        var attributes = (RealNameAttribute[])fieldInfo.GetCustomAttributes(typeof(RealNameAttribute), false);

        if (attributes.Length &gt; 0) {
            name = attributes[0].Name;
        }

        return name;
    }
    public static bool IsIgnored(this Enum value) {
        if (value == null) {
            throw new ArgumentException("value");
        }

        string name = value.ToString();
        var fieldInfo = value.GetType().GetField(name);

        return fieldInfo == null || fieldInfo.IsDefined(typeof(IgnoreAttribute), true);
    }

    public static Dictionary&lt;int, string&gt; ToDictionary(this Type enumType) { 
        return Enum.GetValues(enumType)
            .Cast&lt;object&gt;()
            .Where(f =&gt; !((Enum)f).IsIgnored())
            .ToDictionary(k =&gt; (int)k, v =&gt; ((Enum)v).GetRealName()); 
    }
}