Get all values from an Enum type
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; public static class Utility { public static object[] GetValues(Type enumType) { if (enumType.IsEnum == false) { throw new ArgumentException("Type " + enumType.Name + " is not an enum!"); } List<Object> values = new List<object>(); var fields = from n in enumType.GetFields() where n.IsLiteral select n; foreach (FieldInfo fi in fields) values.Add(fi.GetValue(enumType)); return values.ToArray(); } }