Export (0) Print
Expand All

Decimal.GetTypeCode Method

Returns the TypeCode for value type Decimal.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public TypeCode GetTypeCode ()
public final TypeCode GetTypeCode ()
public final function GetTypeCode () : TypeCode
Not applicable.

Return Value

The enumerated constant TypeCode.Decimal.

The following code example uses the GetTypeCode method to return the type code for Decimal value type.

// Example of the decimal.GetTypeCode method. 
using System;

class DecimalGetTypeCodeDemo
{
    public static void Main( )
    {
        Console.WriteLine( "This example of the " +
            "decimal.GetTypeCode( ) \nmethod " +
            "generates the following output.\n" );

        // Create a decimal object and get its type code.
        decimal aDecimal = new decimal( 1.0 );
        TypeCode typCode = aDecimal.GetTypeCode( );

        Console.WriteLine( "Type Code:      \"{0}\"", typCode );
        Console.WriteLine( "Numeric value:  {0}", (int)typCode );
    }
}

/*
This example of the decimal.GetTypeCode( )
method generates the following output.

Type Code:      "Decimal"
Numeric value:  15
*/

// Example of the decimal.GetTypeCode method. 
import System.*;

class DecimalGetTypeCodeDemo
{
    public static void main(String[] args)
    {
        Console.WriteLine("This example of the " 
            + "decimal.GetTypeCode( ) \nmethod " 
            + "generates the following output.\n");

        // Create a decimal object and get its type code.
        System.Decimal aDecimal = new System.Decimal(1.0);
        TypeCode typCode = aDecimal.GetTypeCode();

        Console.WriteLine("Type Code:      \"{0}\"", typCode);
        Console.WriteLine("Numeric value:  {0}",
            System.Convert.ToString((int)typCode));
    } //main
} //DecimalGetTypeCodeDemo

/*
This example of the decimal.GetTypeCode( )
method generates the following output.

Type Code:      "Decimal"
Numeric value:  15
*/

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2015 Microsoft