EncoderFallbackBuffer.Fallback 方法

定义

指示在无法对原始输入进行编码时是否有可用的替代字符串,或是否应忽略原始输入。Indicates whether a substitute string is available when the original input cannot be encoded, or whether the original input should be ignored.

重载

Fallback(Char, Int32)

在派生类中重写后,此方法对回退缓冲区进行准备,以处理指定的输入字符。When overridden in a derived class, prepares the fallback buffer to handle the specified input character.

Fallback(Char, Char, Int32)

在派生类中重写后,此方法对回退缓冲区进行准备,以处理指定的代理项对。When overridden in a derived class, prepares the fallback buffer to handle the specified surrogate pair.

Fallback(Char, Int32)

在派生类中重写后,此方法对回退缓冲区进行准备,以处理指定的输入字符。When overridden in a derived class, prepares the fallback buffer to handle the specified input character.

public:
 abstract bool Fallback(char charUnknown, int index);
public abstract bool Fallback (char charUnknown, int index);
abstract member Fallback : char * int -> bool
Public MustOverride Function Fallback (charUnknown As Char, index As Integer) As Boolean

参数

charUnknown
Char

一个输入字符。An input character.

index
Int32

该字符在输入缓冲区中的索引位置。The index position of the character in the input buffer.

返回

Boolean

如果回退缓冲区能处理 charUnknown 则为 true;如果回退缓冲区忽略 charUnknown,则为 falsetrue if the fallback buffer can process charUnknown; false if the fallback buffer ignores charUnknown.

注解

Encoding.GetBytes如果和 Encoder.Convert 方法 Fallback(Byte[], Int32) 遇到无法编码的未知输入字符,则调用。The Encoding.GetBytes and Encoder.Convert methods call Fallback(Byte[], Int32) if they encounter an unknown input character that cannot be encoded. 返回值 true 指示回退缓冲区可以处理输入字符,这将导致调用方法调用 GetNextChar 方法来获取回退缓冲区的每个字符。A return value of true indicates that the fallback buffer can process the input character, which causes the calling method to call the GetNextChar method to obtain each character of the fallback buffer. 由于它不处理单个字符, Fallback 异常回退处理程序中的方法将引发异常。Because it does not process individual characters, the Fallback method in an exception fallback handler throws an exception.

适用于

Fallback(Char, Char, Int32)

在派生类中重写后,此方法对回退缓冲区进行准备,以处理指定的代理项对。When overridden in a derived class, prepares the fallback buffer to handle the specified surrogate pair.

public:
 abstract bool Fallback(char charUnknownHigh, char charUnknownLow, int index);
public abstract bool Fallback (char charUnknownHigh, char charUnknownLow, int index);
abstract member Fallback : char * char * int -> bool
Public MustOverride Function Fallback (charUnknownHigh As Char, charUnknownLow As Char, index As Integer) As Boolean

参数

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.

返回

Boolean

如果回退缓冲区可以处理 charUnknownHighcharUnknownLow,则为 true;如果回退缓冲区忽略代理项对,则为 falsetrue if the fallback buffer can process charUnknownHigh and charUnknownLow; false if the fallback buffer ignores the surrogate pair.

注解

Encoding.GetBytes如果和 Encoder.Convert 方法 Fallback(Char, Char, Int32) 在其输入中遇到代理项对,则调用。The Encoding.GetBytes and Encoder.Convert methods call Fallback(Char, Char, Int32) if they encounter a surrogate pair in their input. 返回值 true 指示回退缓冲区可以处理代理项对,这将导致调用方法调用 GetNextChar 方法来获取回退缓冲区的每个字符。A return value of true indicates that the fallback buffer can process the surrogate pair, which causes the calling method to call the GetNextChar method to obtain each character of the fallback buffer. 由于它不处理单个字符, Fallback 异常回退处理程序中的方法将引发异常。Because it does not process individual characters, the Fallback method in an exception fallback handler throws an exception.

适用于