You can use the Enum.GetUnderlyingType static method to find out what the underlying type is that is being used to store an enumerated type’s enumerated values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public enum Moods : byte{ NOMOOD = 0, Ambivalent = 1, Crabby = 10, Grouchy = Crabby - 1, Happy = 42, SuperHappy = 2 * Happy}static void Main(){ Type moodStorageType = Enum.GetUnderlyingType(typeof(Moods)); var min = moodStorageType.GetField("MinValue").GetValue(null); var max = moodStorageType.GetField("MaxValue").GetValue(null); Console.WriteLine("Underlying type for Moods is: {0}", moodStorageType.FullName); Console.WriteLine("Values can range from {0} to {1}", min, max);} |

