<PackageReference Include="System.Xml.XDocument" Version="4.0.11-beta-23409" />

System.Xml.Linq.XDocument

public class XDocument : XContainer
Represents an XML document. For the components and usage of an XDocument object, see XDocument Class Overview.To browse the .NET Framework source code for this type, see the Reference Source.
public XDeclaration Declaration { get; set; }

Gets or sets the XML declaration for this document.

public XDocumentType DocumentType { get; }

Gets the Document Type Definition (DTD) for this document.

public XElement Root { get; }

Gets the root element of the XML Tree for this document.

public XDocument()

Initializes a new instance of the XDocument class.

public XDocument(object[] content)

Initializes a new instance of the XDocument class with the specified content.

public XDocument(XDeclaration declaration, object[] content)

Initializes a new instance of the XDocument class with the specified XDeclaration and content.

public XDocument(XDocument other)

Initializes a new instance of the XDocument class from an existing XDocument object.

public static XDocument Load(string uri)

Creates a new XDocument from a file.

public static XDocument Load(string uri, LoadOptions options)

Creates a new XDocument from a file, optionally preserving white space, setting the base URI, and retaining line information.

public static XDocument Load(Stream stream)

Creates a new XDocument instance by using the specified stream.

public static XDocument Load(Stream stream, LoadOptions options)

Creates a new XDocument instance by using the specified stream, optionally preserving white space, setting the base URI, and retaining line information.

public static XDocument Load(TextReader textReader)

Creates a new XDocument from a TextReader.

public static XDocument Load(TextReader textReader, LoadOptions options)

Creates a new XDocument from a TextReader, optionally preserving white space, setting the base URI, and retaining line information.

public static XDocument Load(XmlReader reader)

Creates a new XDocument from an XmlReader.

public static XDocument Load(XmlReader reader, LoadOptions options)

Loads an XDocument from an XmlReader, optionally setting the base URI, and retaining line information.

public static XDocument Parse(string text)

Creates a new XDocument from a string.

public static XDocument Parse(string text, LoadOptions options)

Creates a new XDocument from a string, optionally preserving white space, setting the base URI, and retaining line information.

public void Save(Stream stream)

Outputs this XDocument to the specified Stream.

public void Save(Stream stream, SaveOptions options)

Outputs this XDocument to the specified Stream, optionally specifying formatting behavior.

public void Save(TextWriter textWriter)

Serialize this XDocument to a TextWriter.

public void Save(TextWriter textWriter, SaveOptions options)

Serialize this XDocument to a TextWriter, optionally disabling formatting.

public void Save(XmlWriter writer)

Serialize this XDocument to an XmlWriter.