XPathNavigator.HasChildren 属性

定义

获取一个值,该值指示当前节点是否有任何子节点。

public:
 virtual property bool HasChildren { bool get(); };
public:
 abstract property bool HasChildren { bool get(); };
public virtual bool HasChildren { get; }
public abstract bool HasChildren { get; }
member this.HasChildren : bool
Public Overridable ReadOnly Property HasChildren As Boolean
Public MustOverride ReadOnly Property HasChildren As Boolean

属性值

Boolean

如果当前节点具有任何子节点,则为 true;否则为 false

注解

XPathNavigator如果定位在不能有子节点的节点上,则HasChildren属性始终返回false

下表列出了每个XPathNodeType节点允许的子节点节点XPathNodeType

XPathNodeType 节点 子 XPathNodeType 节点
Root Element、节点 CommentProcessingInstruction 节点。 注意: DocumentFragmentRoot 使用 XmlDocument 类时等效,并且可以具有与元素相同的子级。
Element Element、、TextCommentWhitespace ProcessingInstructionSignificantWhitespace节点。
所有其他 XPathNodeType 节点 不能有子节点。

适用于

另请参阅