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!

CodePageEncoding.GetChars

Decodes a range of an array of bytes into an array of characters and returns the number characters stored in the array.

[Visual Basic]
Overrides Public Function GetChars( _
   ByVal bytes() As Byte, _
   ByVal byteIndex As Integer, _
   ByVal byteCount As Integer, _
   ByVal chars() As Char, _
   ByVal charIndex As Integer _
) As Integer
[C#]
public override int GetChars(
   byte[] bytes,
   int byteIndex,
   int byteCount,
   char[] chars,
   int charIndex
);
[C++]
public: override int GetChars(
   unsigned char* bytes[],
   int byteIndex,
   int byteCount,
   __wchar_t* chars[],
   int charIndex
);
[JScript]
public override function GetChars(
   bytes : Byte[],
   byteIndex : int,
   byteCount : int,
   chars : Char[],
   charIndex : int
) : int;

Parameters

bytes
The byte array to decode.
byteIndex
The starting index of the byte array to decode.
byteCount
The number of bytes to decode.
chars
The character array to decode into.
charIndex
The starting index of the resulting decoding in the character array.

Return Value

The number of characters stored into the character array.

Exceptions

Exception Type Condition
ArgumentException The bytes or chars arguments are null.
ArgumentException The byteIndex and byteCount arguments do not denote a valid range in the byte array.
ArgumentException The charIndex or byteIndex arguments are not a valid index.
ArgumentException The charIndex argument is less than 0.
ArgumentException The charIndex argument is greater than length of the character array.
ArgumentException The chars argument is not large enough to hold the decoding of the bytes.
System.Globalization.Encoding.BufferOverflow The charIndex argument is equal to the length of the character array.
System.Globalization.Encoding.BufferOverflow . No characters have been stored into the character array.

Remarks

This method overrides Encoding.GetChars.

The GetCharCount method can be used to determine the exact number of characters that will be produced for a specified range of bytes. Alternatively, the GetMaxCharCount method can be used to determine the maximum number of characters that will be produced for a specified number of bytes, regardless of the actual byte values.

See Also

CodePageEncoding Class | CodePageEncoding Members | System.Globalization Namespace