Returns a Unicode byte order mark encoded in UTF-16 format
using System;
using System.Text;
class UnicodeEncodingExample {
public static void Main() {
Byte[] byteOrderMark = Encoding.Unicode.GetPreamble();
foreach (Byte b in byteOrderMark) {
Console.Write("[{0}]", b);
}
UnicodeEncoding bigEndianUnicode = new UnicodeEncoding(true, true);
byteOrderMark = bigEndianUnicode.GetPreamble();
foreach (Byte b in byteOrderMark) {
Console.Write("[{0}]", b);
}
}
}
Related examples in the same category