Convert.ToInt16 Method (Byte)


Converts the value of the specified 8-bit unsigned integer to the equivalent 16-bit signed integer.

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

Public Shared Function ToInt16 (
	value As Byte
) As Short


Type: System.Byte

The 8-bit unsigned integer to convert.

Return Value

Type: System.Int16

A 16-bit signed integer that is equivalent to value.

The following example converts each element in an array of Byte values to a 16-bit signed integer.

Dim bytes() As Byte = { Byte.MinValue, 14, 122, Byte.MaxValue}
Dim result As Short

For Each byteValue As Byte In bytes
   result = Convert.ToInt16(byteValue)
   Console.WriteLine("The Byte value {0} converts to {1}.", _
                     byteValue, result)
' The example displays the following output:
'       The Byte value 0 converts to 0.
'       The Byte value 14 converts to 14.
'       The Byte value 122 converts to 122.
'       The Byte value 255 converts to 255.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top