mscorlib 2.0.0.0 4.0.0.0 System.Object

An encoding maps a Unicode character to an encoded sequence of bytes. A particular encoding is represented by a type that is derived from the class. Specifically, a character is encoded to a byte sequence by calling the encoding type's method, and the byte sequence is decoded to a character array or a string by calling the or method.

A decoding operation can fail if the input byte sequence cannot be mapped by the encoding. For example, an object cannot decode a byte sequence if that sequence represents a character that has a code point value that is outside the range U+0000 to U+007F.

When a decoding conversion cannot be performed, the .NET Framework provides a failure-handling mechanism called a fallback. Your application can use predefined .NET Framework decoder fallbacks, or it can create a custom decoder fallback derived from the and classes.

and are the base classes for all decoding fallback handlers in the .NET Framework. They support the following three kinds of fallback handling mechanisms:

Best-fit fallback, which maps valid Unicode characters that cannot be decoded to an approximate equivalent. For example, a best-fit fallback handler for the class might map Æ (U+00C6) to AE (U+0041 + U+0045). A best-fit fallback handler might also be implemented to transliterate one alphabet (such as Cyrillic) to another (such as Latin or Roman). The .NET Framework does not provide any public best-fit fallback implementations.

Replacement fallback, which replaces each character that cannot be decoded with a predefined string. The .NET Framework provides a predefined replacement fallback handler. The class replaces each byte sequence that cannot be decoded with a question mark character ("?", or U+003F) or a REPLACEMENT CHARACTER (U+FFFD). You can customize the replacement string by specifying a substitute in the call to the constructor. After the substitute string is emitted, the decoding operation continues converting the remainder of the input.

Exception fallback, which throws an exception when a byte sequence cannot be decoded. The .NET Framework provides a predefined exception fallback handler. The class throws a when an invalid byte sequence is encountered, and the decoding operation terminates.

If you choose to implement a custom solution, you must override the following abstract members of the class:

The method, which returns a class instance derived from . Depending on the type of fallback handler that you are developing, the implementation is responsible for performing the mapping or replacement, or for throwing the exception.

The property, which returns the maximum number of characters that the fallback implementation can return. For an exception fallback handler, its value should be zero.

For more information about encoding, decoding, and fallback strategies, see Character Encoding in the .NET Framework.

Provides a failure-handling mechanism, called a fallback, for an encoded input byte sequence that cannot be converted to an output character.

- Constructor
  2.0.0.0
  4.0.0.0
  To be added.

  Initializes a new instance of the class.

- Method
  2.0.0.0
  4.0.0.0
  System.Text.DecoderFallbackBuffer

  This method returns an object derived from that is responsible for performing the fallback operation. For example, of the predefined implementations in the .NET Framework, the method returns a object, and the method returns a object.

  The method is called by a decoder when it encounters the first byte that it is unable to decode. The object returned by this method provides the fallback implementation and is responsible for returning the string that replaces the byte or bytes that could not be decoded.

  When overridden in a derived class, initializes a new instance of the class.

  An object that provides a fallback buffer for a decoder.

- Property
  2.0.0.0
  4.0.0.0
  System.Text.DecoderFallback To be added. To be added.

  Gets an object that throws an exception when an input byte sequence cannot be decoded.

- Property
  2.0.0.0
  4.0.0.0
  System.Int32 To be added.

  For an exception fallback handler, this property should return zero.

  When overridden in a derived class, gets the maximum number of characters the current object can return.

- Property
  2.0.0.0
  4.0.0.0
  System.Text.DecoderFallback To be added. To be added.

  Gets an object that outputs a substitute string in place of an input byte sequence that cannot be decoded.