System.Xml.XmlDocument.CloneNode Method

Creates a duplicate of this node.

Syntax

public override XmlNode CloneNode (bool deep)

Parameters

deep
true to recursively clone the subtree under the specified node; false to clone only the node itself.

Returns

The cloned XmlDocument node.

Remarks

This method serves as a copy constructor for nodes. The cloned node has no parent (XmlNode.ParentNode returns null).

If deep is true, the cloned node includes all the child nodes, otherwise only the XmlDocument node is cloned. See the XmlNode.CloneNode(bool) method to see how this method behaves on other node types.

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