System.Xml.XPath.XPathNodeIterator.Current Property

When overridden in a derived class, gets the System.Xml.XPath.XPathNavigator object for this System.Xml.XPath.XPathNodeIterator, positioned on the current context node.

Syntax

public abstract XPathNavigator Current { get; }

Value

An System.Xml.XPath.XPathNavigator instance that represents the current node.

Remarks

You can use the properties of the returned System.Xml.XPath.XPathNavigator object to obtain information on the current node. However, the returned System.Xml.XPath.XPathNavigator object should not be modified. The returned System.Xml.XPath.XPathNavigator object cannot be moved away from the selected node set.

Alternatively, you can clone the System.Xml.XPath.XPathNavigator object using the XPathNavigator.Clone method of the System.Xml.XPath.XPathNavigator class. The cloned System.Xml.XPath.XPathNavigator object can then be moved away from the selected node set. This method of cloning the System.Xml.XPath.XPathNavigator object might affect the performance of the XPath query.

If the erload:System.Xml.XPath.XPathNavigator.SelectAncestors, erload:System.Xml.XPath.XPathNavigator.SelectDescendants, and erload:System.Xml.XPath.XPathNavigator.SelectChildren methods result in no nodes being selected, the XPathNodeIterator.Current property might not be pointing to the context node.

To test whether nodes have been selected, use the XPathNodeIterator.Count property as shown in the following example.

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