MinValue Field
Collapse the table of content
Expand the table of content

SByte.MinValue Field

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Represents the smallest possible value of SByte. This field is constant.

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

'Declaration
Public Const MinValue As SByte

The value of this constant is -128; that is, hexadecimal 0x80.

The following example uses the MinValue and MaxValue fields to verify that an Int64 value is within the range of the SByte type before it performs a type conversion. This verification prevents an OverflowException at run time.


Dim longValue As Long = -130
Dim byteValue As SByte

If longValue <= SByte.MaxValue AndAlso _
   longValue >= SByte.MinValue Then
   byteValue = CSByte(longValue)
   outputBlock.Text += String.Format("Converted long integer value to {0}.", byteValue) + vbCrLf
Else
   Dim rangeLimit As SByte
   Dim relationship As String

   If longValue > SByte.MaxValue Then
      rangeLimit = SByte.MaxValue
      relationship = "greater"
   Else
      rangeLimit = SByte.MinValue
      relationship = "less"
   End If

   outputBlock.Text += String.Format("Conversion failure: {0:n0} is {1} than {2}.", _
                     longValue, _
                     relationship, _
                     rangeLimit) + vbCrLf
End If


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft