Load values from an enumerator to a collection

This is not a regular requirement for a developer. But, I guess, this can be helpful at times; I have included an example wherein you require to add enumerator to a collection, thus we avoid creating a new instance

 

public static object[] GetValues(Type enumType)
{
     if (!enumType.IsEnum)
     {
          throw new ArgumentException("Type '" + enumType.Name + "' is not an enum");
     }
 
     List

Comments