Maximum value of "enum"

Hello,

How to get maximum value of enumeration? Like this:

enum SomeEnumeration {
  A = 1,
  B = 2,
  H = 30
}

Maybe this will work?

Enum.GetValues(typeof(SomeEnumeration)).Cast<SomeEnumeration>().Last();

Got it from here:

http://stackoverflow.com/questions/203377/getting-the-max-value-of-an-enum

It depends if you specify a base type or not

If the enum contains floating point types, it'll be 7.9 1028 (via Decimal)

If it's an integer type, it'll be 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (via long)

Generally it'll use int and float until the higher ranges are needed

Note - added this because it was a little ambiguous whether you wanted the highest used or the highest possible