title: Extension Methods for IEnumerable<Enum>?
body: <p>I have a bunch of different enums, such as...</p>
  
  <pre><code> public enum MyEnum
  {
    [Description("Army of One")]
    one, 
    [Description("Dynamic Duo")]
    two,
    [Description("Three Amigo's")]
    three,
    [Description("Fantastic Four")]
    four,
    [Description("The Jackson Five")]
    five
  }
  </code></pre>
  
  <p>I wrote an extension method for any Enum to get the Description attribute if it has one.  Simple enough right...</p>
  
  <pre><code>public static string GetDescription(this Enum currentEnum)
  {
    var fi = currentEnum.GetType().GetField(currentEnum.ToString());
    var da = (DescriptionAttribute)Attribute.GetCustomAttribute(fi, typeof(DescriptionAttribute));
    return da != null ? da.Description : currentEnum.ToString();
  }
  </code></pre>
  
  <p>I can use this very simply and it works like a charm, returning the description or ToString() as expected.</p>
  
  <p>Here is the problem though.  I would like to have the ability to call this on an IEnumerable of MyEnum, YourEnum, or SomeoneElsesEnum.  So I wrote the following extension just as simply.</p>
  
  <pre><code>public static IEnumerable&lt;string&gt; GetDescriptions(this IEnumerable&lt;Enum&gt; enumCollection)
  {
    return enumCollection.ToList().ConvertAll(a =&gt; a.GetDescription());
  }
  </code></pre>
  
  <p>This doesn't work.  It compiles fine as a method, but using it gives the following error:</p>
  
  <pre><code>Instance argument: cannot convert from 'System.Collections.Generic.IEnumerable&lt;MyEnum&gt;' to System.Collections.Generic.IEnumerable&lt;System.Enum&gt;'
  </code></pre>
  
  <p>So why is this?
  Can I make this work?</p>
  
  <p>The only answer I have found at this point is to write extension methods for generic T as follows:</p>
  
  <pre><code>public static IEnumerable&lt;string&gt; GetDescriptions&lt;T&gt;(this List&lt;T&gt; myEnumList) where T : struct, IConvertible
  public static string GetDescription&lt;T&gt;(this T currentEnum) where T : struct, IConvertible
  </code></pre>
  
  <p>Someone must have a better answer for this, or an explanation of why I can extend an Enum but not an IEnumerable of Enum...
  Anyone?</p>