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)

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

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

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

.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.

© 2014 Microsoft