Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an encoded output byte sequence.
Namespace:
System.Text
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
<SerializableAttribute> _
Public MustInherit Class EncoderFallback
Dim instance As EncoderFallback
[SerializableAttribute]
public abstract class EncoderFallback
[SerializableAttribute]
public ref class EncoderFallback abstract
public abstract class EncoderFallback
An encoding maps a Unicode character to an encoded sequence of bytes, which can subsequently be transferred to a physical medium, such as a disk, or over a communications link. Characters can be mapped in various ways, and a particular encoding is represented by a type derived from the Encoding class. Specifically, the encoding type's GetBytes method encodes a character to a byte sequence, and the GetChars method decodes a byte sequence to a character.
An encoding operation can fail if the input character cannot be represented by the encoding. For example, a ASCIIEncoding object cannot encode a character that yields a Unicode code point value that is outside the range U+0000 to U+007F.
When an encoding or decoding conversion cannot be performed, the .NET Framework provides a failure-handling mechanism called a fallback. Your application can use predefined .NET Framework encoder and decoder fallbacks, or it can create a custom encoder fallback derived from the EncoderFallback and EncoderFallbackBuffer classes or a custom decoder fallback derived from the DecoderFallback and DecoderFallbackBuffer classes.
The .NET Framework provides two predefined classes that implement different fallback strategies for handling encoding conversion failures. The EncoderReplacementFallback class substitutes a string provided in place of any input character that cannot be converted. The substitute string is encoded in place of the invalid character, and then the encoding operation continues converting the remainder of the input. In contrast, the EncoderExceptionFallback class throws a EncoderFallbackException when an invalid character is encountered.
System..::.Object
System.Text..::.EncoderFallback
System.Text..::.EncoderExceptionFallback
System.Text..::.EncoderReplacementFallback
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0
Reference
Other Resources