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

屬性值

如果目前的節點有任何子節點,則為 true,否則會傳回 false

備註

XPathNavigator如果 位於不能有子節點的節點上,則 HasChildren 屬性一律會傳 false 回 。

下表列出每個 XPathNodeType 節點允許的子節點 XPathNodeType 節點。

XPathNodeType 節點 子 XPathNodeType 節點
Root ElementCommentProcessingInstruction 節點。 注意:DocumentFragment相當於 Root 使用 XmlDocument 類別,而且可以有與專案相同的子系。
Element ElementTextCommentProcessingInstructionWhitespaceSignificantWhitespace 節點。
所有其他 XPathNodeType 節點 不能有子節點。

適用於

另請參閱