EncoderReplacementFallbackBuffer.Fallback Method

Definition

Prepares the replacement fallback buffer to use the current replacement string.

Overloads

Fallback(Char, Int32)

Prepares the replacement fallback buffer to use the current replacement string.

Fallback(Char, Char, Int32)

Indicates whether a replacement string can be used when an input surrogate pair cannot be encoded, or whether the surrogate pair can be ignored. Parameters specify the surrogate pair and the index position of the pair in the input.

Fallback(Char, Int32)

Source:
EncoderReplacementFallback.cs
Source:
EncoderReplacementFallback.cs
Source:
EncoderReplacementFallback.cs

Prepares the replacement fallback buffer to use the current replacement string.

C#
public override bool Fallback(char charUnknown, int index);

Parameters

charUnknown
Char

An input character. This parameter is ignored in this operation unless an exception is thrown.

index
Int32

The index position of the character in the input buffer. This parameter is ignored in this operation.

Returns

true if the replacement string is not empty; false if the replacement string is empty.

Exceptions

This method is called again before the GetNextChar() method has read all the characters in the replacement fallback buffer.

Remarks

The GetBytes and Convert methods call Fallback if they encounter an unknown character in their input. If the return value of Fallback is true, the calling method can invoke the GetNextChar method to obtain each character in the replacement fallback buffer.

Applies to

.NET 10 ve diğer sürümler
Ürün Sürümler
.NET 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 2.0, 2.1

Fallback(Char, Char, Int32)

Source:
EncoderReplacementFallback.cs
Source:
EncoderReplacementFallback.cs
Source:
EncoderReplacementFallback.cs

Indicates whether a replacement string can be used when an input surrogate pair cannot be encoded, or whether the surrogate pair can be ignored. Parameters specify the surrogate pair and the index position of the pair in the input.

C#
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index);

Parameters

charUnknownHigh
Char

The high surrogate of the input pair.

charUnknownLow
Char

The low surrogate of the input pair.

index
Int32

The index position of the surrogate pair in the input buffer.

Returns

true if the replacement string is not empty; false if the replacement string is empty.

Exceptions

This method is called again before the GetNextChar() method has read all the replacement string characters.

The value of charUnknownHigh is less than U+D800 or greater than U+D8FF.

-or-

The value of charUnknownLow is less than U+DC00 or greater than U+DFFF.

Remarks

The GetBytes and Convert methods call Fallback if they encounter an unknown character in their input. If the return value of Fallback is true, the calling method can invoke the GetNextChar method to obtain each character in the replacement fallback buffer.

Applies to

.NET 10 ve diğer sürümler
Ürün Sürümler
.NET 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 2.0, 2.1