Evaluates the specified XPath expression and returns the typed result, using the System.Xml.IXmlNamespaceResolver object specified to resolve namespace prefixes in the XPath expression.
- xpath
A string representing an XPath expression that can be evaluated.
- resolver
The System.Xml.IXmlNamespaceResolver object used to resolve namespace prefixes in the XPath expression.
![]()
The result of the expression (Boolean, number, string, or node set). This maps to bool, double, string, or System.Xml.XPath.XPathNodeIterator objects respectively.
The following C# code returns a number after converting the Price/text() node to a number and multiplying the value by 10.
Example
XPathExpression expr = nav.Compile("Price/text()*10"); nav.Evaluate(expr);
The XPath position() and last() functions, unless used as a predicate in a location step, require a reference to a node set in order to be evaluated. In this case, you must use the overload which takes an System.Xml.XPath.XPathNodeIterator as an argument; otherwise, position() and last() return 0.
This method has no effect on the state of the System.Xml.XPath.XPathNavigator.