I wrote a function for this and it works fine on both Windows and XB360 so far.
(Why the code snippet function in the forum is not work?!)
==
using System.Reflection;
public static Enum[] GetEnumValues(Type enumType)
{
if (enumType.BaseType == typeof(Enum))
{
FieldInfo[] info = enumType.GetFields(BindingFlags.Static | BindingFlags.Public);
Enum[] values = new Enum[info.Length];
for (int i=0; i<values.Length; ++i)
{
values[i] = (Enum)info[i].GetValue(null);
}
return values;
}
else
{
throw new Exception("Given type is not an Enum type");
}
}
==
BTW, this function is so useful and I wonder why it is not supported in the .NET CF?