This documentation is archived and is not being maintained.

Decimal.GetTypeCode Method

Returns the TypeCode for value type Decimal.

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

Public Function GetTypeCode As TypeCode
Dim instance As Decimal
Dim returnValue As TypeCode

returnValue = instance.GetTypeCode
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. 
Imports System
Imports Microsoft.VisualBasic

Module DecimalGetTypeCodeDemo
    Sub Main( )
        Console.WriteLine( "This example of the " & _
            "Decimal.GetTypeCode( ) " & vbCrLf & "method " & _
            "generates the following output." & vbCrLf )

        ' Create a Decimal object and get its type code.
        Dim aDecimal    As Decimal  = New Decimal( 1.0 )
        Dim typCode     As TypeCode = aDecimal.GetTypeCode( )

        Console.WriteLine( "Type Code:      ""{0}""", typCode )
        Console.WriteLine( "Numeric value:  {0}", CInt( typCode ) )
    End Sub
End Module 

' 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}",
    } //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