C# Enum GetTypeCode

Description

Enum GetTypeCode returns the underlying TypeCode for this instance.

Syntax

Enum.GetTypeCode has the following syntax.


public TypeCode GetTypeCode()

Returns

Enum.GetTypeCode method returns The type for this instance.

Example

The following code shows how to use Enum.GetTypeCode.


/* w w w .  j  av a2s .co  m*/
using System;

enum Colors { Red, Green, Blue, Yellow };

public class FormatTest {
    public static void Main() {
        Colors myColor = Colors.Blue;

        Console.WriteLine(myColor.GetTypeCode());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version