Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Decimal.MinusOne Field

Represents the number negative one (-1).

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

'Declaration
<DecimalConstantAttribute(, , , , )> _
Public Shared ReadOnly MinusOne As Decimal

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


' Example of the Decimal fields.
Module Example
   Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

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

      outputBlock.Text &= _
          "This example of the fields of the Decimal structure" & _
          vbCrLf & "generates the following output." & vbCrLf + vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Field or Expression", "Value") & vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "-------------------", "-----") & vbCrLf

      ' Display the values of the Decimal fields.
      outputBlock.Text &= String.Format(numberFmt, "Decimal.MaxValue", _
          Decimal.MaxValue) + vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Decimal.MinValue", _
          Decimal.MinValue) + vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Decimal.MinusOne", _
          Decimal.MinusOne) + vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Decimal.One", _
          Decimal.One) + vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Decimal.Zero", _
          Decimal.Zero) + vbCrLf
      outputBlock.Text &= vbCrLf

      ' Display the values of expressions of the Decimal fields.
      outputBlock.Text &= String.Format(exprFmt, _
          "( Decimal.MinusOne + Decimal.One ) = Decimal.Zero", _
          (Decimal.MinusOne + Decimal.One) = Decimal.Zero) + vbCrLf
      outputBlock.Text &= String.Format(exprFmt, _
          "Decimal.MaxValue + Decimal.MinValue", _
          Decimal.MaxValue + Decimal.MinValue) + vbCrLf
      outputBlock.Text &= String.Format(exprFmt, _
          "Decimal.MinValue / Decimal.MaxValue", _
          Decimal.MinValue / Decimal.MaxValue) + vbCrLf
      outputBlock.Text &= String.Format("{0,-40}{1,30}", _
          "100000000000000D / Decimal.MaxValue", _
          100000000000000D / Decimal.MaxValue) + vbCrLf
   End Sub
End Module
' This example 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


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft