I belive this is the same as in the .NET Compact Framework. If we make the assumption that your enum values start at 0 and use every value until their range is over the following code should work.
public static IList<int> GetEnumValues(Type oEnumType)
{
int iLoop = 0;
bool bDefined = true;
List<int> oList = new List<int>();
//Loop values
do
{
//Check if the value is defined
if (Enum.IsDefined(oEnumType, iLoop))
{
//Add item to the value list and increment
oList.Add(iLoop);
++iLoop;
}
else
{
//Set undefined
bDefined = false;
}
} while (bDefined);
//Return the list
return oList;
}
Obviously you could tweak the code to return the enum names or to match diferent patterns e.g. bitwise values.