using System;
using System.Text;
class EncoderExample {
public static void Main() {
Byte[] bytes;
Char[] chars = new Char[] {
'\u03a3' // Sigma
};
Encoder uniEncoder = Encoding.Unicode.GetEncoder();
int byteCount = uniEncoder.GetByteCount(chars, 0, chars.Length, true);
bytes = new Byte[byteCount];
int bytesEncodedCount = uniEncoder.GetBytes(chars, 0, chars.Length, bytes, 0, true);
Console.WriteLine(bytesEncodedCount);
foreach (Byte b in bytes) {
Console.Write("[{0}]", b);
}
}
}