BitConverter.ToUInt16 Method
.NET Framework 1.1
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.
This method is not CLS-compliant. For more information about CLS compliance, see What is the Common Language Specification.
[Visual Basic] <CLSCompliant(False)> Public Shared Function ToUInt16( _ ByVal value() As Byte, _ ByVal startIndex As Integer _ ) As UInt16 [C#] [CLSCompliant(false)] public static ushort ToUInt16( byte[] value, int startIndex ); [C++] [CLSCompliant(false)] public: static unsigned short ToUInt16( unsigned char value __gc[], int startIndex ); [JScript] public CLSCompliant(false) static function ToUInt16( value : Byte[], startIndex : int ) : UInt16;
Parameters
- value
- The array of bytes.
- startIndex
- The starting position within value.
Return Value
A 16-bit unsigned integer formed by two bytes beginning at startIndex.
Exceptions
| 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. |
Requirements
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 | UInt16