XmlWriter.WriteSurrogateCharEntity(Char, Char) 方法

定義

在衍生類別中覆寫時,產生和寫入 Surrogate 字元字組的 Surrogate 字元實體。

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

低 Surrogate。 這必須是一個介於 0xDC00 和 0xDFFF 之間的值。

highChar
Char

高 Surrogate。 這必須一個是介於 0xD800 和 0xDBFF 之間的值。

例外狀況

傳送無效的 Surrogate 字元字組。

在先前的非同步作業完成前呼叫了 XmlWriter 方法。 在此情況下,會擲回 InvalidOperationException 與「非同步作業已經在進行中」的訊息。

備註

這個方法僅適用于使用 UTF-16 編碼的系統。

Surrogate 字元實體是以十六進位格式撰寫。 代理字元的範圍#x10000為#x10FFFF。 下列公式用來產生代理字元實體: (highChar -0xD800) * 0x400 + (lowChar -0xDC00) + 0x10000

對於 HTML 和 XML,檔字元集 (,因此) 數值字元參考的標記法是以 UCS [ISO-10646] 為基礎。 因此,原始檔案中的單一數值字元參考可能會對應至字串中的兩個 16 位單位, (高 Surrogate 和低 Surrogate) 。 這些 16 位單位稱為 Surrogate 字組。

如需代理或字元的詳細資訊,請參閱位於 的 Unicode 3.0/Unicode 2.0 標準 https://www.unicode.org 第 3.7 節,或 W3C XML 1.0 建議的第 2.2 節

如需這個方法的非同步版本,請參閱 WriteSurrogateCharEntityAsync

適用於