NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Buffer.ByteLength

Returns the total number of bytes in this array.

[Visual Basic]
Public Shared Function ByteLength( _
   ByVal array As Array _
) As Integer
[C#]
public static int ByteLength(
   Array array
);
[C++]
public: static int ByteLength(
   Array* array
);
[JScript]
public static function ByteLength(
   array : Array
) : int;

Parameters

array
The array where the bytes will be counted.

Return Value

The number of bytes in the array.

Exceptions

Exception Type Condition
ArgumentException If the array is not a primitive.
ArgumentNullException If the array is null.

Remarks

The ByteLength method gets a particular byte out of an array. The array must be an array of primitives. It essentially does the following:

return array.length * sizeof(array.UnderlyingElementType)

Example [C#]

[C#]

int [] arr = new int [5] = {0, 1, 2, 3, 4};
Assert (arr.ByteLength == 20);
for (int i = 0; i < arr.ByteLength; i++)
  {
  Console.Write (arr[i].GetByte(i));
  }
//this
will print:
//00000001000200030004

See Also

Buffer Class | Buffer Members | System Namespace