Encoding::GetCharCount Method (array<Byte>)
When overridden in a derived class, calculates the number of characters produced by decoding all the bytes in 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.
Return Value
Type: System::Int32The number of characters produced by decoding the specified sequence of bytes.
| Exception | Condition |
|---|---|
| ArgumentNullException | bytes is nullptr. |
| 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.