Creates a new XDeclaration from explicit values or by copying another.
The XML version string.
The encoding name (pass "" to omit).
The standalone value (pass "" to omit).
ReadonlyencodingThe character encoding, e.g. "UTF-8". Empty string if omitted.
ReadonlystandaloneThe standalone flag ("yes" or "no"). Empty string if omitted.
ReadonlyversionThe XML version, typically "1.0".
Compares this declaration to another by version, encoding, and standalone.
The declaration to compare against.
true if all three fields are equal.
Returns the XML declaration string, e.g. <?xml version='1.0' encoding='UTF-8'?>.
The serialized XML declaration.
Represents the XML declaration (
<?xml ...?>).Remarks
XDeclaration is not a node; it is held by XDocument and serialized at the beginning of the document output.
Example