System.Xml.XPath.XPathNavigator.Evaluate Method

Uses the supplied context to evaluate the System.Xml.XPath.XPathExpression, and returns the typed result.

Syntax

public virtual object Evaluate (XPathExpression expr, XPathNodeIterator context)

Parameters

expr
An System.Xml.XPath.XPathExpression that can be evaluated.
context
An System.Xml.XPath.XPathNodeIterator that points to the selected node set that the evaluation is to be performed on.

Returns

The result of the expression (Boolean, number, string, or node set). This maps to bool, double, string, or System.Xml.XPath.XPathNodeIterator objects respectively.

Remarks

The expression is evaluated using the XPathNodeIterator.Current node of the System.Xml.XPath.XPathNodeIterator as the context node. If context is null, the node on which the System.Xml.XPath.XPathNavigator is currently positioned is used as the context node.

The position() and last() functions, unless used as a predicate in a location step, always return 0 under the following conditions:

Because the position() and last() functions work on the current node, you should not use the XPathNodeIterator.Current property to move away from the selected node set. This could invalidate the state of the System.Xml.XPath.XPathNavigator.

This method has no effect on the state of the 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