Encoding.BigEndianUnicode Property
Gets an encoding for the UTF-16 format that uses the big endian byte order.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Text.EncodingAn encoding object for the UTF-16 format that uses the big endian byte order.
The UnicodeEncoding object that is returned by this property may not have the appropriate behavior for your app. 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.UnicodeEncoding(Boolean, Boolean, Boolean) constructor to instantiate a big endian UnicodeEncoding object whose fallback is either an EncoderFallbackException or a DecoderFallbackException, as the following example illustrates.
The returned UnicodeEncoding object has BodyName, HeaderName, and 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.
The following example reads a text file with a UTF-16 encoding using the big endian byte order.
The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1