Freigeben über


Decimal.GetTypeCode-Methode

Gibt den TypeCode für den Werttyp Decimal zurück.

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

Syntax

'Declaration
Public Function GetTypeCode As TypeCode
'Usage
Dim instance As Decimal
Dim returnValue As TypeCode

returnValue = instance.GetTypeCode
public TypeCode GetTypeCode ()
public:
virtual TypeCode GetTypeCode () sealed
public final TypeCode GetTypeCode ()
public final function GetTypeCode () : TypeCode

Rückgabewert

Die Enumerationskonstante TypeCode.Decimal.

Beispiel

Im folgenden Codebeispiel wird der Typencode für den Decimal-Werttyp mithilfe der GetTypeCode-Methode zurückgegeben.

' 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. 
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. 
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
*/

Plattformen

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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Decimal-Struktur
Decimal-Member
System-Namespace