Export (0) Print
Expand All

SByte.MinValue Field

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

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

'Declaration
Public Const MinValue As SByte
'Usage
Dim value As SByte 

value = SByte.MinValue

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)
   Console.WriteLine("Converted long integer value to {0}.", byteValue)
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       

   Console.WriteLine("Conversion failure: {0:n0} is {1} than {2}.", _ 
                     longValue, _
                     relationship, _
                     rangeLimit)
End If       

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft