Gemstone Common Library
Show/Hide TOC

# BigEndianToUInt16(Byte, Int32) Method

Returns a 16-bit unsigned integer converted from two bytes, accounting for target endian-order, at a specified position in a byte array.

## Definition

Namespace: Gemstone
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.163 -- Release Build+087b6813ba03894bf4bfe2466a2a63a9702d9bb9
C#
View Source Request Example

    public static ushort ToUInt16(
    	byte[] buffer,
    	int startIndex
    )

VB
View Source Request Example

    Public Shared Function ToUInt16 (
    	buffer As Byte(),
    	startIndex As Integer
    ) As UShort

C++
View Source Request Example

    public:
    static unsigned short ToUInt16(
    	array<unsigned char>^ buffer,
    	int startIndex
    )

JavaScript
View Source Request Example

    Gemstone.BigEndian.ToUInt16 = function(buffer, startIndex);

#### Parameters

buffer Byte
  An array of bytes (i.e., buffer containing binary image of value).
startIndex Int32
  The starting position within value.

#### Return Value

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

## Exceptions

ArgumentNullException | value is null.
ArgumentOutOfRangeException | startIndex is less than zero or greater than the length of value minus 1.

## See Also

#### Reference

BigEndian Class
ToUInt16 Overload
Gemstone Namespace