System.Xml.XmlTextReader.Encoding Property

Gets the encoding of the document.

Syntax

public System.Text.Encoding Encoding { get; }

Value

If the XmlTextReader.ReadState is ReadState.Interactive, a System.Text.Encoding; otherwise null.

Remarks

Note:

In the dnprdnext release, the recommended practice is to create System.Xml.XmlReader instances using the erload:System.Xml.XmlReader.Create method. This allows you to take full advantage of the new features introduced in this release. For more information, see Creating XML Readers.

Because System.Xml.XmlTextReader uses the System.Text.Encoding class, XmlTextReader also supports all encodings supported by that class. The exception to this is any encoding, such as UTF-7 or EBCDIC, that maps the <?xml sequence to different byte values than UTF-8.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0