Encoding::GetCharCount Method (array<Byte>, Int32, Int32)
When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Parameters
- bytes
- Type: array<System::Byte>
The byte array containing the sequence of bytes to decode.
- index
- Type: System::Int32
The zero-based index of the first byte to decode.
- count
- Type: System::Int32
The number of bytes to decode.
Return Value
Type: System::Int32The number of characters produced by decoding the specified sequence of bytes.
| Exception | Condition |
|---|---|
| ArgumentNullException | bytes is nullptr. |
| ArgumentOutOfRangeException | index or count is less than zero. -or- index and count do not denote a valid range in bytes. |
| DecoderFallbackException | A fallback occurred (see Understanding Encodings for complete explanation). |
To calculate the exact array size required by GetChars to store the resulting characters, the application should use GetCharCount. To calculate the maximum array size, the application should use GetMaxCharCount. The GetCharCount method generally allocates less memory, while the GetMaxCharCount method generally executes faster.
For a discussion of programming considerations for use of this method, see the Encoding class description.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.