System.BitConverter.ToUInt16 Method

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

Syntax

[System.CLSCompliant(false)]
public static ushort ToUInt16 (byte[] value, int startIndex)

Parameters

value
The array of bytes.
startIndex
The starting position within value.

Returns

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

Remarks

The BitConverter.ToUInt16(Byte[], int) method converts the bytes from index startIndex to startIndex + 1 to a ushort value. The order of bytes in the array must reflect the endianness of the computer system's architecture; for more information, see the Remarks section of the BitConverter class topic.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0