Decodes a sequence of bytes from the specified byte array into the specified character array.
using System;
using System.Text;
class UTF8EncodingExample {
public static void Main() {
Char[] chars;
Byte[] bytes = new Byte[] {69, 120, 97, 109, 112, 108, 101};
UTF8Encoding utf8 = new UTF8Encoding();
int charCount = utf8.GetCharCount(bytes, 2, 13);
chars = new Char[charCount];
int charsDecodedCount = utf8.GetChars(bytes, 2, 13, chars, 0);
Console.WriteLine(charsDecodedCount);
foreach (Char c in chars) {
Console.Write("[{0}]", c);
}
}
}
Related examples in the same category