title: Determine underlying integral type of an Enum in C#
body: <p>Consider the following enumerations:</p>
  
  <pre><code>enum TestSByte:  sbyte  { Value1, Value2, }
  enum TestInt16:  short  { Value1, Value2, }
  enum TestInt32:  int    { Value1, Value2, }
  enum TestInt64:  long   { Value1, Value2, }
  enum TestByte:   byte   { Value1, Value2, }
  enum TestUInt16: ushort { Value1, Value2, }
  enum TestUInt32: uint   { Value1, Value2, }
  enum TestUInt64: ulong  { Value1, Value2, }
  
  var types = new Type []
  {
      typeof(TestSByte),
      typeof(TestInt16),
      typeof(TestInt32),
      typeof(TestInt64),
      typeof(TestByte),
      typeof(TestUInt16),
      typeof(TestUInt32),
      typeof(TestUInt64),
  };
  
  foreach (var type in types)
  {
      Console.WriteLine("Type: {0} - {1}.", type.Name, type.BaseType.Name);
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Type: TestSByte - Enum.
  Type: TestInt16 - Enum.
  Type: TestInt32 - Enum.
  Type: TestInt64 - Enum.
  Type: TestByte - Enum.
  Type: TestUInt16 - Enum.
  Type: TestUInt32 - Enum.
  Type: TestUInt64 - Enum.
  </code></pre>
  
  <p>What I actually want is to determine what the underlying integral type of each Enum is. I could not find any indication of the same while browsing type definitions in the watch window. Please advise.</p>