linq-xml查询的执行时间较长。请引导我简单地查询或任何选项,如编译查询(这不适用于xml)。
查询是这样的:
rootNode.Descendants(ns + "childNodeName")
.Where(
childNode =>
childNode.Descendants(ns + "grandChild")
.Any(grandChild=> grandChild.Attribute("attribute").Value.Equals("condString")));发布于 2013-09-18 14:18:09
Elements()比Descendants()快,所以如果你只需要孩子而不是所有的子代,那么可以使用Elements()。根据您使用的名称,这听起来像是这样。
否则,向我们展示您的XML。
https://stackoverflow.com/questions/18865067
复制相似问题