C# UnicodeEncoding UnicodeEncoding(Boolean, Boolean, Boolean)

Description

UnicodeEncoding UnicodeEncoding(Boolean, Boolean, Boolean) Initializes a new instance of the UnicodeEncoding class. Parameters specify whether to use the big endian byte order, whether to provide a Unicode byte order mark, and whether to throw an exception when an invalid encoding is detected.

Syntax

UnicodeEncoding.UnicodeEncoding(Boolean, Boolean, Boolean) has the following syntax.


public UnicodeEncoding(
  bool bigEndian,/*from   w  w  w  .  j a v  a2  s.  c  o  m*/
  bool byteOrderMark,
  bool throwOnInvalidBytes
)

Parameters

UnicodeEncoding.UnicodeEncoding(Boolean, Boolean, Boolean) has the following parameters.

  • bigEndian - true to use the big endian byte order (most significant byte first); false to use the little endian byte order (least significant byte first).
  • byteOrderMark - true to specify that a Unicode byte order mark is provided; otherwise, false.
  • throwOnInvalidBytes - true to specify that an exception should be thrown when an invalid encoding is detected; otherwise, false.

Example


using System;//from   www  .j a v  a  2  s  . co m
using System.Text;

public class SamplesUnicodeEncoding  {

   public static void Main()  {

      UnicodeEncoding u16withED = new UnicodeEncoding( true, true, true );
      UnicodeEncoding u16noED   = new UnicodeEncoding( true, true, false );

   }

}




















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding