using System; using System.Text; class Program { static void Main() { var str = Encoding.ASCII.GetString(new byte[] { 0x54, 0x65, 0x73, 0x74, 0x20, 0x6D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65 }); Console.WriteLine("Input: {0}", str); var bytes = Encoding.Unicode.GetBytes(str + "\0"); Console.Write("Output:"); foreach (var b in bytes) { Console.Write(' '); Console.Write(b.ToString("X2")); } Console.WriteLine(); } }