Decimal.MinValue フィールド

Decimal の最小有効値を表します。このフィールドは定数であり、読み取り専用です。

Public Shared ReadOnly MinValue As Decimal
[C#]
public static readonly decimal MinValue;
[C++]
public: static Decimal MinValue;
[JScript]
public static var MinValue : Decimal;

解説

この定数の値は負の 79,228,162,514,264,337,593,543,950,335 です。

使用例

[Visual Basic, C#, C++] MinValue フィールドの使用方法については、次のコード例を参照してください。

 
' Example of the Decimal fields.
Imports System
Imports Microsoft.VisualBasic

Module DecimalFieldsDemo
    
    Sub Main( )

        Const numberFmt As String = "{0,-25}{1,45:N0}"
        Const exprFmt As String = "{0,-55}{1,15}"

        Console.WriteLine( _
            "This example of the fields of the Decimal structure" & _
            vbCrLf & "generates the following output." & vbCrLf )
        Console.WriteLine( numberFmt, "Field or Expression", "Value" )
        Console.WriteLine( numberFmt, "-------------------", "-----" )

        ' Display the values of the Decimal fields.
        Console.WriteLine( numberFmt, "Decimal.MaxValue", _
            Decimal.MaxValue )
        Console.WriteLine( numberFmt, "Decimal.MinValue", _
            Decimal.MinValue )
        Console.WriteLine( numberFmt, "Decimal.MinusOne", _
            Decimal.MinusOne )
        Console.WriteLine( numberFmt, "Decimal.One", _
            Decimal.One )
        Console.WriteLine( numberFmt, "Decimal.Zero", _
            Decimal.Zero )
        Console.WriteLine( )

        ' Display the values of expressions of the Decimal fields.
        Console.WriteLine( exprFmt, _
            "( Decimal.MinusOne + Decimal.One ) = Decimal.Zero", _
            ( Decimal.MinusOne + Decimal.One ) = Decimal.Zero )
        Console.WriteLine( exprFmt, _
            "Decimal.MaxValue + Decimal.MinValue", _
            Decimal.MaxValue + Decimal.MinValue )
        Console.WriteLine( exprFmt, _
            "Decimal.MinValue / Decimal.MaxValue", _
            Decimal.MinValue/Decimal.MaxValue )
        Console.WriteLine( "{0,-40}{1,30}", _
            "100000000000000D / Decimal.MaxValue", _
            100000000000000D / Decimal.MaxValue )
    End Sub 
End Module 

' This example of the fields of the Decimal structure
' generates the following output.
' 
' Field or Expression                                              Value
' -------------------                                              -----
' Decimal.MaxValue                79,228,162,514,264,337,593,543,950,335
' Decimal.MinValue               -79,228,162,514,264,337,593,543,950,335
' Decimal.MinusOne                                                    -1
' Decimal.One                                                          1
' Decimal.Zero                                                         0
' 
' ( Decimal.MinusOne + Decimal.One ) = Decimal.Zero                 True
' Decimal.MaxValue + Decimal.MinValue                                  0
' Decimal.MinValue / Decimal.MaxValue                                 -1
' 100000000000000D / Decimal.MaxValue     0.0000000000000012621774483536

[C#] 
// Example of the Decimal fields.
using System;

class DecimalFieldsDemo
{
    public static void Main( )
    {
        const string numberFmt = "{0,-25}{1,45:N0}";
        const string exprFmt = "{0,-55}{1,15}";

        Console.WriteLine( 
            "This example of the fields of the Decimal structure " +
            "\ngenerates the following output.\n" );
        Console.WriteLine( numberFmt, "Field or Expression", "Value" );
        Console.WriteLine( numberFmt, "-------------------", "-----" );

        // Display the values of the Decimal fields.
        Console.WriteLine( numberFmt, "Decimal.MaxValue", 
            Decimal.MaxValue );
        Console.WriteLine( numberFmt, "Decimal.MinValue", 
            Decimal.MinValue );
        Console.WriteLine( numberFmt, "Decimal.MinusOne", 
            Decimal.MinusOne );
        Console.WriteLine( numberFmt, "Decimal.One", Decimal.One );
        Console.WriteLine( numberFmt, "Decimal.Zero", Decimal.Zero );
        Console.WriteLine( );

        // Display the values of expressions of the Decimal fields.
        Console.WriteLine( exprFmt, 
            "( Decimal.MinusOne + Decimal.One ) == Decimal.Zero", 
            (Decimal.MinusOne + Decimal.One ) == Decimal.Zero );
        Console.WriteLine( exprFmt, 
            "Decimal.MaxValue + Decimal.MinValue", 
            Decimal.MaxValue + Decimal.MinValue );
        Console.WriteLine( exprFmt, 
            "Decimal.MinValue / Decimal.MaxValue", 
            Decimal.MinValue / Decimal.MaxValue );
        Console.WriteLine( "{0,-40}{1,30}", 
            "100000000000000M / Decimal.MaxValue", 
            100000000000000M / Decimal.MaxValue );
    }
}

/*
This example of the fields of the Decimal structure
generates the following output.

Field or Expression                                              Value
-------------------                                              -----
Decimal.MaxValue                79,228,162,514,264,337,593,543,950,335
Decimal.MinValue               -79,228,162,514,264,337,593,543,950,335
Decimal.MinusOne                                                    -1
Decimal.One                                                          1
Decimal.Zero                                                         0

( Decimal.MinusOne + Decimal.One ) == Decimal.Zero                True
Decimal.MaxValue + Decimal.MinValue                                  0
Decimal.MinValue / Decimal.MaxValue                                 -1
100000000000000M / Decimal.MaxValue     0.0000000000000012621774483536
*/

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

void main( )
{
    String* numberFmt = S"{0,-25}{1,45:N0}";
    String* exprFmt = S"{0,-55}{1,15}";

    Console::WriteLine( 
        S"This example of the fields of the Decimal structure " 
        S"\ngenerates the following output.\n" );
    Console::WriteLine( numberFmt, S"Field or Expression", S"Value" );
    Console::WriteLine( numberFmt, S"-------------------", S"-----" );

    // Display the values of the Decimal fields.
    Console::WriteLine( numberFmt, S"Decimal::MaxValue", 
        __box( Decimal::MaxValue ) );
    Console::WriteLine( numberFmt, S"Decimal::MinValue", 
        __box( Decimal::MinValue ) );
    Console::WriteLine( numberFmt, S"Decimal::MinusOne", 
        __box( Decimal::MinusOne ) );
    Console::WriteLine( numberFmt, S"Decimal::One", 
        __box( Decimal::One ) );
    Console::WriteLine( numberFmt, S"Decimal::Zero", 
        __box( Decimal::Zero ) );
    Console::WriteLine( );

    // Display the values of expressions of the Decimal fields.
    Console::WriteLine( exprFmt, 
        S"( Decimal::MinusOne + Decimal::One ) == Decimal::Zero", 
        __box( ( Decimal::MinusOne + Decimal::One ) == 
            Decimal::Zero ) );
    Console::WriteLine( exprFmt, 
        S"Decimal::MaxValue + Decimal::MinValue", 
        __box( Decimal::MaxValue + Decimal::MinValue ) );
    Console::WriteLine( exprFmt, 
        S"Decimal::MinValue / Decimal::MaxValue", 
        __box( Decimal::MinValue / Decimal::MaxValue ) );
    Console::WriteLine( S"{0,-40}{1,30}", 
        S"100000000000000M / Decimal::MaxValue", 
        __box( Convert::ToDecimal( 100000000000000 ) / 
            Decimal::MaxValue ) );
}

/*
This example of the fields of the Decimal structure
generates the following output.

Field or Expression                                              Value
-------------------                                              -----
Decimal::MaxValue               79,228,162,514,264,337,593,543,950,335
Decimal::MinValue              -79,228,162,514,264,337,593,543,950,335
Decimal::MinusOne                                                   -1
Decimal::One                                                         1
Decimal::Zero                                                        0

( Decimal::MinusOne + Decimal::One ) == Decimal::Zero             True
Decimal::MaxValue + Decimal::MinValue                                0
Decimal::MinValue / Decimal::MaxValue                               -1
100000000000000M / Decimal::MaxValue    0.0000000000000012621774483536
*/

[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, Common Language Infrastructure (CLI) Standard

参照

Decimal 構造体 | Decimal メンバ | System 名前空間 | Zero | One | MinusOne | MaxValue