This documentation is archived and is not being maintained.

BitConverter.ToInt16 Method

Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array.

[Visual Basic]
Public Shared Function ToInt16( _
   ByVal value() As Byte, _
   ByVal startIndex As Integer _
) As Short
public static short ToInt16(
 byte[] value,
 int startIndex
public: static short ToInt16(
 unsigned char value __gc[],
 int startIndex
public static function ToInt16(
   value : Byte[],
 startIndex : int
) : Int16;


An array of bytes.
The starting position within value.

Return Value

A 16-bit signed integer formed by two bytes beginning at startIndex.


Exception Type Condition
ArgumentNullException value is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException startIndex is less than zero or greater than the length of value minus 2.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

BitConverter Class | BitConverter Members | System Namespace | Int16