XmlTextWriter.WriteSurrogateCharEntity(Char, Char) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Generates and writes the surrogate character entity for the surrogate character pair.
public:
override void WriteSurrogateCharEntity(char lowChar, char highChar);
public override void WriteSurrogateCharEntity (char lowChar, char highChar);
override this.WriteSurrogateCharEntity : char * char -> unit
Public Overrides Sub WriteSurrogateCharEntity (lowChar As Char, highChar As Char)
- lowChar
- Char
The low surrogate. This must be a value between 0xDC00
and 0xDFFF
.
- highChar
- Char
The high surrogate. This must be a value between 0xD800
and 0xDBFF
.
An invalid surrogate character pair was passed.
Note
Starting with the .NET Framework 2.0, we recommend that you create XmlWriter instances by using the XmlWriter.Create method and the XmlWriterSettings class to take advantage of new functionality.
This method is only applicable on systems that use UTF-16 encoding.
The surrogate character entity is written in hexadecimal format. The range for surrogate characters is #x10000
to #x10FFFF
. The following formula is used to generate the surrogate character entity: (highChar
- 0xD800
) * 0x400
+ (lowChar
- 0xDC00
) + 0x10000
.
For both HTML and XML, the document character set (and therefore the notation of numeric character references) is based on UCS [ISO-10646]. 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). These 16-bit units are referred to as a surrogate pair.
For more information regarding surrogates or characters, refer to section 3.7 of the Unicode 3.0/Unicode 2.0 standard, or section 2.2 of the W3C XML 1.0 Recommendation.
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 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 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: