Mega Code Archive

 
Categories / C# / Internationalization
 

Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array

using System; using System.Text; class UTF8EncodingExample {     public static void Main() {         Byte[] bytes = new Byte[] {69, 120,  97, 109, 112, 108, 101};         UTF8Encoding utf8 = new UTF8Encoding();         int charCount = utf8.GetCharCount(bytes, 2, 8);         Console.WriteLine(charCount);     } }