Export (0) Print
Expand All

Decimal.One Field

Represents the number one (1).

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

'Declaration
Public Shared ReadOnly One As Decimal

The following code example illustrates the use of the One field.

' 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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft