using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
publicstaticclass Utility
{
publicstatic object[] GetValues(Type enumType)
{
if (enumType.IsEnum == false)
{
thrownew 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();
}
}