System.Text.DecoderFallback Class

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

See Also: DecoderFallback Members


public abstract class DecoderFallback


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 System.Text.Encoding class. Specifically, a character is encoded to a byte sequence by calling the encoding type's Encoding.GetBytes(string) method, and the byte sequence is decoded to a character array or a string by calling the Encoding.GetChars(Byte[]) or Encoding.GetString(Byte[]) method.

A decoding operation can fail if the input byte sequence cannot be mapped by the encoding. For example, an System.Text.ASCIIEncoding 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 System.Text.DecoderFallback and System.Text.DecoderFallbackBuffer classes.

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

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

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


Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0