Mono Class Library: System.Text.Encoding Overview | Members

System.Text.Encoding.GetChars Method

Decodes the specified range of the specified byte array into the specified range of the specified char array.

public abstract int GetChars (byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)

Parameters

bytes
The byte array to decode.
byteIndex
A int containing the first index of bytes to decode.
byteCount
A int containing the number of bytes to decode.
chars
The char array to decode into.
charIndex
A int containing the first index of chars to decode into.

Returns

The number of characters stored in chars.

Exceptions

TypeReason
ArgumentExceptionchars does not contain sufficient space to store the decoded characters.
ArgumentNullException

bytes is null .

-or-

chars is null .

ArgumentOutOfRangeException

byteIndex < 0.

-or-

byteCount < 0.

-or-

charIndex < 0.

-or-

byteIndex and byteCount do not specify a valid range in bytes (i.e. (byteIndex + byteCount ) > bytes.Length).

-or-

charIndex > chars.Length.

Remarks

Operation

This method requires the caller to provide the destination buffer and ensure that the buffer is large enough to hold the entire result of the conversion.

Note to Inheritors
This method is overridden by types derived from System.Text.Encoding to perform the particular decoding.

Usage
When using this method directly on a System.Text.Encoding object or on an associated System.Text.Decoder or System.Text.Encoder, use Encoding.GetCharCount(Byte[]) or Encoding.GetMaxCharCount(int) to allocate destination buffers.

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0