System.Text.Encoding.BigEndianUnicode Property

Gets an encoding for the UTF-16 format that uses the big endian byte order.


public static Encoding BigEndianUnicode { get; }


A System.Text.Encoding for the Unicode format in big-endian byte order.


The System.Text.UnicodeEncoding object that is returned by this property may not have the appropriate behavior for your application. It uses replacement fallback to replace each string that it cannot encode and each byte that it cannot decode with a question mark ("?") character. Instead, you can call the UnicodeEncoding.#ctor(bool, bool, bool) constructor to instantiate a big endian System.Text.UnicodeEncoding object whose fallback is either an System.Text.EncoderFallbackException or a System.Text.DecoderFallbackException, as the following example illustrates.

code reference: System.Text.Encoding.BigEndianUnicode#2

The returned System.Text.UnicodeEncoding object has Encoding.BodyName, Encoding.HeaderName, and Encoding.WebName properties, which yield the name "unicodeFFFE". Although the UTF-16 big endian byte order mark is hexadecimal FEFF, the name "unicodeFFFE" was chosen because the byte order mark appears as hexadecimal FFFE on little endian Windows computers.


Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,