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.160 -- Release Build+19b74ac03cedad8575bb1ceb00051318b7421d0d
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