BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Object

Converts blocks of characters into blocks of bytes.

Following instantiation of a , sequential blocks of characters are converted into blocks of bytes through calls to the method. The encoder maintains state between the conversions, allowing it to correctly encode character sequences that span adjacent blocks. An instance of a specific implementation of the class is typically obtained through a call to the .

The following example demonstrates using the class to convert one character array to two byte arrays.

`using System; using System.Text; public class EncoderExample { public static void Main() { string str = "Encoder"; char[] cAry = str.ToCharArray(); UTF8Encoding utf = new UTF8Encoding(); Encoder e = utf.GetEncoder(); int count1 = e.GetByteCount(cAry,0,cAry.Length-4,false); int count2 = e.GetByteCount(cAry,cAry.Length-4,4,true); byte[] bytes1 = new byte[count1]; byte[] bytes2 = new byte[count2]; e.GetBytes(cAry,0,cAry.Length-4,bytes1,0,false); e.GetBytes(cAry,cAry.Length-4,4,bytes2,0,true); Console.Write("Bytes1: "); foreach (byte b in bytes1) Console.Write(" '{0}' ", b); Console.WriteLine(); Console.Write("Bytes2: "); foreach (byte b in bytes2) Console.Write(" '{0}' ", b); Console.WriteLine(); } }`

The output is

Bytes1: '69' '110' '99'

Bytes2: '111' '100' '101' '114'

- Constructor

  Constructs a new instance of the class.

  This constructor is called only by classes that inherit from the class.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void `` `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.CLSCompliant(false) System.Runtime.InteropServices.ComVisible(false)
- Method
  System.Void `` `` `` `` `` `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.InteropServices.ComVisible(false)
- Property
  System.Runtime.InteropServices.ComVisible(false)
  System.Text.EncoderFallback To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Property
  System.Runtime.InteropServices.ComVisible(false)
  System.Text.EncoderFallbackBuffer To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.Int32 `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.CLSCompliant(false) System.Runtime.InteropServices.ComVisible(false)
- Method
  System.Int32 `` `` `` `` A array of characters to encode. A that specifies the first index of to encode. A that specifies the number of elements in to encode. A value that determines whether the current instance flushes its internal state following a conversion. Specify to flush the internal state of the current instance following a conversion; otherwise, specify .

  Determines the exact number of bytes required to encode the specified range in the specified array of

  characters.

  A containing the number of bytes required to encode the range in from to + -1 for a particular encoding.

  This value takes into account the state in which the current instance was left following the last call to .

  The state of the current instance is not affected by a call to this method.

  As described above.

  Override this method to retrieve the exact number of bytes required to encode a specified range of an array of objects for a particular encoding.

  Use this method to determine the exact number of bytes required to encode the specified range of an array of objects for a particular encoding.

  is .

  Return value is greater than .

  -or-

  < 0.

  -or-

  < 0.

  -or-

  and do not specify a valid range in (i.e. ( + ) > .Length).

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Int32 `` `` `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.CLSCompliant(false) System.Runtime.InteropServices.ComVisible(false)
- Method
  System.Int32 `` `` `` `` `` `` A array of characters to encode. A that specifies the first index of to encode. A that specifies the number of elements in to encode. A array to encode into. A that specifies the first index of to encode into.

  A value. Specify to flush the internal state of the current instance following a conversion; otherwise, specify . To ensure correct termination of a sequence of blocks of encoded bytes, it is recommended that the last call to specify .

  Encodes the specified range of the specified array of characters into the specified range of the specified array of bytes.

  A containing the number of bytes encoded into for a particular encoding.

  The encoding takes into account the state in which the current instance was left following the last call to this method if was specified as for that call.

  As described above.

  Override this method to encode the values of an array of objects as an array of objects for a particular encoding.

  Use this method to encode the values of an array of objects as an array of objects for a particular encoding.

  does not contain sufficient space to store the encoded characters.

  is .

  -or-

  is .

  < 0.

  -or-

  < 0.

  -or-

  < 0.

  -or-

  (.Length - ) < .

  -or-

  > .Length.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.Void To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.InteropServices.ComVisible(false)
0 System.Runtime.InteropServices.ComVisible(true)