Selects the first node that matches the specified expression.
[Visual Basic] Overridable Public Function SelectSingle( _ ByVal xpathexpr As Object _ ) As Boolean [C#] public virtual bool SelectSingle( object xpathexpr ); [C++] public: virtual bool SelectSingle( Object* xpathexpr ); [JScript] public function SelectSingle( xpathexpr : Object ) : Boolean;
true if a node was found; otherwise, false.
Exception Type | Condition |
---|---|
ArgumentException | The specified XPath expression is not a string or was not a result of a Compile method call.
Or the XPath expression does not return a node. |
This is the same as Select except it selects a only the first matching node. So instead of writing the following code:
[C#]
nav.Select("Customer/Address/Street"); if (nav.MoveToFirstSelected()) street = nav.InnerText;
You would use this code:
[C#]
if (nav.SelectSingle("Customer/Address/Street")) street = nav.InnerText;
This method has no effect on the current selection state.
XmlNavigator Class | XmlNavigator Members | System.NewXml Namespace