XmlWriter.WriteSurrogateCharEntity(Char, Char) XmlWriter.WriteSurrogateCharEntity(Char, Char) XmlWriter.WriteSurrogateCharEntity(Char, Char) XmlWriter.WriteSurrogateCharEntity(Char, Char) Method

定義

在衍生類別中覆寫時,產生和寫入 Surrogate 字元字組的 Surrogate 字元實體。When overridden in a derived class, generates and writes the surrogate character entity for the surrogate character pair.

public:
 abstract void WriteSurrogateCharEntity(char lowChar, char highChar);
public abstract void WriteSurrogateCharEntity (char lowChar, char highChar);
abstract member WriteSurrogateCharEntity : char * char -> unit
Public MustOverride Sub WriteSurrogateCharEntity (lowChar As Char, highChar As Char)

參數

lowChar
Char Char Char Char

低 Surrogate。The low surrogate. 這必須是一個介於 0xDC00 和 0xDFFF 之間的值。This must be a value between 0xDC00 and 0xDFFF.

highChar
Char Char Char Char

高 Surrogate。The high surrogate. 這必須一個是介於 0xD800 和 0xDBFF 之間的值。This must be a value between 0xD800 and 0xDBFF.

例外狀況

傳送無效的 Surrogate 字元字組。An invalid surrogate character pair was passed.

在先前的非同步作業完成前呼叫了 XmlWriter 方法。An XmlWriter method was called before a previous asynchronous operation finished. 在此情況下,會擲回 InvalidOperationException 與「非同步作業已經在進行中」的訊息。In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

備註

這個方法才適用使用 utf-16 編碼的系統上。This method is only applicable on systems that use UTF-16 encoding.

Surrogate 字元實體是以十六進位格式。The surrogate character entity is written in hexadecimal format. Surrogate 字元的範圍是以 #x10FFFF #x 10000。The range for surrogate characters is #x10000 to #x10FFFF. 下列公式用來產生 surrogate 字元實體: (highChar -0xD800) * 0x400 + (lowChar -0xDC00) + 0x10000The following formula is used to generate the surrogate character entity: (highChar -0xD800) * 0x400 + (lowChar -0xDC00) + 0x10000

HTML 和 XML 文件的字元集,因此數字字元參考的標記法) 根據 UCS [ISO 10646]。For both HTML and XML, the document character set (and therefore the notation of numeric character references) is based on UCS [ISO-10646]. 來源文件中的單一數字字元參考可能會因此在某些情況下對應至字串 (為高 surrogate 和低 surrogate) 中的兩個 16 位元單位。A single numeric character reference in a source document may therefore in some cases correspond to two 16-bit units in a string (a high surrogate and a low surrogate). 這些的 16 位元單位稱為 surrogate 字組。These 16-bit units are referred to as a surrogate pair.

如需 surrogate 或多個字元的詳細資訊,請參閱的區段 3.7 Unicode standard 3.0/Unicode 2.0 位於https://www.unicode.org,或一節的 W3C XML 1.0 建議事項的 2.2For more information regarding surrogates or characters, refer to section 3.7 of the Unicode 3.0/Unicode 2.0 standard located at https://www.unicode.org, or section 2.2 of the W3C XML 1.0 Recommendation.

這個方法的非同步版本,請參閱WriteSurrogateCharEntityAsyncFor the asynchronous version of this method, see WriteSurrogateCharEntityAsync.

適用於