Returns the underlying type of the specified enumeration type.
- enumType
- The Type of an enumeration.
A Type instance that describes the underlying type of enumType.
Type Reason ArgumentNullException enumType is a null reference. ArgumentException enumType is not an enumeration type.
Documentation for this section has not yet been entered.
The following example demonstrates the Enum.GetUnderlyingType(Type) method.
C# Example
using System; public enum Colors { Red, White, Blue } public class EnumUnderlyingTypeTest { public static void Main() { Type t = Colors.GetUnderlyingType( typeof(Colors) ); Console.WriteLine("The underlying type of Colors is {0}.", t.ToString()); } }The output is
The underlying type of Colors is System.Int32.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0