XPathNavigator.IsDescendant(XPathNavigator) Method

Definition

Determines whether the specified XPathNavigator is a descendant of the current XPathNavigator.

C#
public virtual bool IsDescendant (System.Xml.XPath.XPathNavigator? nav);
C#
public virtual bool IsDescendant (System.Xml.XPath.XPathNavigator nav);

Parameters

nav
XPathNavigator

The XPathNavigator to compare to this XPathNavigator.

Returns

true if the specified XPathNavigator is a descendant of the current XPathNavigator; otherwise, false.

Remarks

An XPathNavigator is a descendant of the current XPathNavigator if it is positioned on a descendant node of the current XPathNavigator. Take, for example, the following XML string:

<item><name>widget</name></item>

If the current XPathNavigator is positioned on the item node, and the XPathNavigator specified is positioned on the name node, IsDescendant returns true.

This method always returns false under the following conditions:

  • The XPathNavigator specified shares the same implementation but points at a different document instance than the current navigator.

  • The XPathNavigator specified has a different implementation than the current navigator.

Applies to

Produit Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1