System.Xml.XmlNode.PrependChild Method

Adds the specified node to the beginning of the list of child nodes for this node.

Syntax

public virtual XmlNode PrependChild (XmlNode newChild)

Parameters

newChild
The node to add. All the contents of the node to be added are moved into the specified location.

Returns

The node added.

Remarks

If the newChild is already in the tree, it is removed from its original position and added to its target position. For more information about inserting nodes, see Inserting Nodes into an XML Document.

If the node being inserted was created from another document, you can use XmlDocument.ImportNode(XmlNode, bool) to import the node to the current document. The imported node can then be inserted into the current document.

This method is a Microsoft extension to the Document Object Model (DOM).

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