Encoding.DecoderFallback Property

Definition

Gets or sets the DecoderFallback object for the current Encoding object.

C#
public System.Text.DecoderFallback DecoderFallback { get; }
C#
public System.Text.DecoderFallback DecoderFallback { get; set; }
C#
[System.Runtime.InteropServices.ComVisible(false)]
public System.Text.DecoderFallback DecoderFallback { get; set; }

Property Value

The decoder fallback object for the current Encoding object.

Attributes

Exceptions

The value in a set operation is null.

A value cannot be assigned in a set operation because the current Encoding object is read-only.

Remarks

The DecoderFallback object represents an error handler that is invoked when an encoded byte sequence cannot be decoded into a character. Any one of the following handler types is supported:

  • A best-fit fallback handler, which replaces bytes that cannot be decoded with some suitable replacement character.

  • A replacement fallback handler, which replaces bytes that cannot be decoded with some arbitrary replacement character. .NET includes one replacement fallback handler, DecoderFallback, which by default replaces bytes that cannot be decoded with a question mark ("?") character.

  • An exception fallback handler, which throws an exception when bytes cannot be decoded. .NET includes one exception fallback handler, DecoderExceptionFallback, which throws a DecoderFallbackException when bytes cannot be decoded.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

See also