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.

代理字元實體是以十六進位格式寫入。The surrogate character entity is written in hexadecimal format. 代理字元的範圍會 #x10000 #x10FFFF。The range for surrogate characters is #x10000 to #x10FFFF. 下列公式是用來產生代理字元實體:(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]. 因此,在某些情況下,來源文件中的單一數值字元參考可能會對應至字串中的 2 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位單位稱為代理配對。These 16-bit units are referred to as a surrogate pair.

如需有關代理或字元的詳細資訊,請參閱位於https://www.unicode.org的 Unicode 3.0/unicode 2.0 標準的3.7 節,或W3C XML 1.0 建議的第 2.2節。For 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.

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

適用於