Export (0) Print
Expand All

Decimal.GetTypeCode Method

Returns the TypeCode for value type Decimal.

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

public:
virtual TypeCode GetTypeCode () sealed
public final TypeCode GetTypeCode ()
public final function GetTypeCode () : TypeCode

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 namespace System;
int 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 = 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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft