System.Text.Encoding.Unicode Property

Gets an encoding for the UTF-16 format using the little endian byte order.


public static Encoding Unicode { get; }


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


For information about the encodings supported by the .NET Framework and a discussion of which Unicode encoding to use, see Understanding Encodings.

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 little 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.Unicode#2


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