次の方法で共有


Decimal.GetTypeCode メソッド

Decimal 値型の TypeCode を返します。

Public Overridable Function GetTypeCode() As TypeCode
[C#]
public virtual TypeCode GetTypeCode();
[C++]
public: virtual TypeCode GetTypeCode();
[JScript]
public function GetTypeCode() : TypeCode;

戻り値

列挙型定数 TypeCode.Decimal

使用例

[Visual Basic, C#, C++] GetTypeCode メソッドを使用して、 Decimal の値の型コードを返す例を次に示します。

 
' 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

[C#] 
// 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
*/

[C++] 
// Example of the Decimal::GetTypeCode method. 
#using <mscorlib.dll>
using namespace System;

void main( )
{
    Console::WriteLine( S"This example of the " 
        S"Decimal::GetTypeCode( ) \nmethod " 
        S"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( S"Type Code:      \"{0}\"", __box( typCode ) );
    Console::WriteLine( S"Numeric value:  {0}", __box( (int)typCode ) );
}

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

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

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

Decimal 構造体 | Decimal メンバ | System 名前空間