System.Xml.XPath.XPathNavigator.Clone Method

When overridden in a derived class, creates a new System.Xml.XPath.XPathNavigator positioned at the same node as this System.Xml.XPath.XPathNavigator.

Syntax

public abstract XPathNavigator Clone ()

Returns

A new System.Xml.XPath.XPathNavigator positioned at the same node as this System.Xml.XPath.XPathNavigator.

Remarks

The XPathNavigator.Clone method is especially useful in conjunction with the System.Xml.XPath.XPathNodeIterator. An System.Xml.XPath.XPathNodeIterator is used to iterate over a selected node set, and contains a XPathNodeIterator.Current property which returns an System.Xml.XPath.XPathNavigator positioned on the context node of the System.Xml.XPath.XPathNodeIterator. However, the System.Xml.XPath.XPathNavigator returned by the XPathNodeIterator.Current property cannot be used to move away from the node set. Instead, you clone the returned System.Xml.XPath.XPathNavigator and use the cloned navigator to do any additional moves.

The cloned System.Xml.XPath.XPathNavigator is not affected by subsequent changes to the original System.Xml.XPath.XPathNavigator.

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0