Mam*_*One 10 .net c# xml linq linq-to-xml
有没有办法计算XDocument上的子节点?
我找了一个计数方法或属性,找不到一个.
谢谢狮子座
Tho*_*que 19
var doc = XDocument.Load(fileName);
int descendantsCount = doc.Descendants().Count(); // counts ALL descendants elements
int childrenCount = doc.Root.Elements().Count(); // counts direct children of the root element
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13976 次 |
最近记录: |