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)

No code example is currently available or this language may not be supported.

Parameters

bytes
Type: array<System::Byte>
The byte array containing the sequence of bytes to decode.

Return Value

Type: System::Int32
The number of characters produced by decoding the specified sequence of bytes.

ExceptionCondition
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.

The following code example encodes a string into an array of bytes, and then decodes the bytes into an array of characters.

No code example is currently available or this language may not be supported.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: