Calculates the maximum number of characters produced by decoding the specified number of bytes. : UTF8Encoding « Internationalization I18N « C# / C Sharp
Calculates the maximum number of characters produced by decoding the specified number of bytes.
using System;
using System.Text;
class UTF8EncodingExample {
publicstaticvoid Main() {
UTF8Encoding utf8 = new UTF8Encoding();
int byteCount = 8;
int maxCharCount = utf8.GetMaxCharCount(byteCount);
Console.WriteLine(maxCharCount);
}
}