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

System.Xml.Linq.XContainer

public abstract class XContainer : XNode
Represents a node that can contain other nodes.
public XNode FirstNode { get; }

Get the first child node of this node.

public XNode LastNode { get; }

Get the last child node of this node.

public void Add(object content)

Adds the specified content as children of this XContainer.

public void Add(object[] content)

Adds the specified content as children of this XContainer.

public void AddFirst(object content)

Adds the specified content as the first children of this document or element.

public void AddFirst(object[] content)

Adds the specified content as the first children of this document or element.

Creates an XmlWriter that can be used to add nodes to the XContainer.

Returns a collection of the descendant nodes for this document or element, in document order.

Returns a collection of the descendant elements for this document or element, in document order.

Returns a filtered collection of the descendant elements for this document or element, in document order. Only elements that have a matching XName are included in the collection.

public XElement Element(XName name)

Gets the first (in document order) child element with the specified XName.

Returns a collection of the child elements of this element or document, in document order.

Returns a filtered collection of the child elements of this element or document, in document order. Only elements that have a matching XName are included in the collection.

Returns a collection of the child nodes of this element or document, in document order.

public void RemoveNodes()

Removes the child nodes from this document or element.

public void ReplaceNodes(object content)

Replaces the children nodes of this document or element with the specified content.

public void ReplaceNodes(object[] content)

Replaces the children nodes of this document or element with the specified content.