using System;
using System.Text;
class MainClass{
public static void Main() {
Char[] chars;
Byte[] bytes = new Byte[] {4, 10, 10, 0, 15, 20, 99, 0, 11, 0, 100, 0, 101, 0};
Decoder uniDecoder = Encoding.Unicode.GetDecoder();
int charCount = uniDecoder.GetCharCount(bytes, 0, bytes.Length);
chars = new Char[charCount];
int charsDecodedCount = uniDecoder.GetChars(bytes, 0, bytes.Length, chars, 0);
Console.WriteLine("{0} characters used to decode bytes.", charsDecodedCount);
foreach (Char c in chars) {
Console.Write("[{0}]", c);
}
}
}
|