
Every enum type has an underlying type. This is always a value type and never a char. The Enum.GetUnderlyingType static method provides a way to determine this underlying type dynamically.

To start, we look at an example program text that invokes the GetUnderlyingType method. There is an enum type that is declared and for the example it has an underlying type of byte. When GetUnderlyingType is called, the System.Byte type is returned.
This C# program calls the Enum.GetUnderlyingType method. It uses typeof.
Program that uses GetUnderlyingType [C#]
using System;
class Program
{
enum Importance : byte
{
Low,
Medium,
High
};
static void Main()
{
// Determine what the underlying type of the enum is.
Type type = Enum.GetUnderlyingType(typeof(Importance));
Console.WriteLine(type);
}
}
Output
System.Byte
So why should you ever use the Enum.GetUnderlyingType method? This method has use in programs that employ reflection upon the metadata, as it can tell you more information about a type. Also, you could develop methods that act upon any enum, but might has separate implementations for different underlying types—such as a method that encodes enums differently.

The Enum.GetUnderlyingType method has limited value in most programs and is probably most useful when using reflection-based programming. This article showed how it can be invoked upon an enum type that uses an unusual underlying type, and that the method result is as expected.
Enum Examples