XMLNodes.Count 属性

定义

获取集合中包含的 XML 文档对象模型 (DOM) 节点对象数的 XMLNodesCollection 计数。

public:
 property int Count { int get(); };
public int Count { get; }
member this.Count : int
Public ReadOnly Property Count As Integer

属性值

示例

在以下示例中, Count 属性在 for 循环中使用,以循环访问由 GetSelectedNodes() 对象的 方法 ViewObject 返回的 XML DOM 节点对象的集合,并显示一个消息框,指示 XMLNodes 集合中包含的每个 XML DOM 节点的名称:

XMLNodes selectedNodes;
selectedNodes = thisXDocument.View.GetSelectedNodes();
for (int i=0; i &lt; selectedNodes.<span class="label">Count</span>; i++)
{
 thisXDocument.UI.Alert("XML DOM node name: " + selectedNodes[i].nodeName);
}

注解

重要说明:可以不受限制地访问此成员。

适用于