Encoding.BigEndianUnicode Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Text
Assembly:  mscorlib (in mscorlib.dll)

static member BigEndianUnicode : Encoding with get

Property Value

Type: System.Text.Encoding

An 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.

No code example is currently available or this language may not be supported.

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.

No code example is currently available or this language may not be supported.

The following example determines the number of bytes required to encode a character array, encodes the characters, and displays the resulting bytes.

No code example is currently available or this language may not be supported.

Universal Windows Platform
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
Return to top
Show: