I have the following enum extension method:public static IList<SelectListItem> SelectListFor<T>(){  Type enumType = typeof(T);  if (enumType.IsEnum)  {    return Enum.GetValues(enumType)    .Cast<int>()    .Where(i => !i.Equals(0))    .Select(e => new SelectListItem()            {            Value = e.ToString(),      Text = GetDisplayName(enumType, Enum.GetName(enumType, e))    })    .ToList();  }  return null;}I can call this by doingEnumExtensions.SelectListFor<BrochureTypes>()And it will allow me to create a drop down list for the values in my BrochureTypes enumHowever, when I compile the code, I get the following warning:CA1004    Consider a design where 'EnumExtensions.SelectListFor()' doesn't require explicit type parameter 'T' in any call to it.  Can I somehow change the above code to overcome this warning? Or should I just suppress the warning?
Extension method to list enum values
c#;generics;reflection;enum;extension methods
As written in the relative MSDN page, the cause of the warning is The parameter signature of an externally visible generic method does not contain types that correspond to all the type parameters of the method.Looking at your code, you get the type of the generic param into the method body (which can be seen also as a violation of the Separation of Concerns principle). In order to solve the issue, you can pass the type as a parameter. The resulting code should be something like the following:public static IList<SelectListItem> SelectListFor(Type enumType){    if (enumType.IsEnum)    {        return Enum.GetValues(enumType)            .Cast<int>()            .Where(i => !i.Equals(0))            .Select(e => new SelectListItem()            {                Value = e.ToString(),                Text = GetDisplayName(enumType, Enum.GetName(enumType, e))            })            .ToList();    }    return null;}and can be called in the following way:EnumExtensions.SelectListFor(typeof(BrochureTypes))As an alternative, you can make it an extension method of the Type class, and I'd suggest a rename of the method in this case:public static IList<SelectListItem> GetSelectList(this Type enumType){    if (enumType.IsEnum)    {        return Enum.GetValues(enumType)            .Cast<int>()            .Where(i => !i.Equals(0))            .Select(e => new SelectListItem()            {                Value = e.ToString(),                Text = GetDisplayName(enumType, Enum.GetName(enumType, e))            })            .ToList();    }    return null;}and call it like this:(typeof(BrochureTypes)).GetSelectList();or:enumInstance.GetType().GetSelectList();