Decodes a range of an array of bytes into an array of characters.
[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;
The number of characters stored into the character array.
Exception Type | Condition |
---|---|
ArgumentException | The bytes or chars parameter is a null reference (in Visual Basic Nothing).
The sum of the byteIndex and byteCount parameters is greater than the length of the byte array. |
ArgumentOutOfRangeException | The byteIndex, byteCount or charIndex parameter is less than zero.
The charIndex parameter is greater than the length of the character array. |
Encoding.BufferOverflow | The the charIndex parameter is equal to the length of the character array.
No bytes have been stored into the byte array. |
Overrides GetChars.
GetCharCount can be used to determine the exact number of characters that will be produced for a specified range of bytes. Alternatively, GetMaxCharCount 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.
UTF8Encoding Class | UTF8Encoding Members | System.Text Namespace | GetCharCount | GetMaxCharCount | GetChars