C# UTF8Encoding GetMaxCharCount
Description
UTF8Encoding GetMaxCharCount
Calculates the maximum
number of characters produced by decoding the specified number of bytes.
Syntax
UTF8Encoding.GetMaxCharCount
has the following syntax.
public override int GetMaxCharCount(
int byteCount
)
Parameters
UTF8Encoding.GetMaxCharCount
has the following parameters.
byteCount
- The number of bytes to decode.
Returns
UTF8Encoding.GetMaxCharCount
method returns The maximum number of characters produced by decoding the specified number
of bytes.
Example
using System;//ww w. j a v a2 s . c o m
using System.Text;
class UTF8EncodingExample {
public static void Main() {
UTF8Encoding utf8 = new UTF8Encoding();
int byteCount = 8;
int maxCharCount = utf8.GetMaxCharCount(byteCount);
Console.WriteLine(maxCharCount);
}
}
The code above generates the following result.