Mega Code Archive

 
Categories / C# / Internationalization
 

Calculates the maximum number of characters produced by decoding the specified number of bytes

using System; using System.Text; class UTF8EncodingExample {     public static void Main() {         UTF8Encoding utf8 = new UTF8Encoding();         int byteCount = 8;         int maxCharCount = utf8.GetMaxCharCount(byteCount);         Console.WriteLine(maxCharCount);     } }