草庐IT

innersection

全部标签

c# - 如何使用 Linq to XML Query 搜索节点?

xml文档下方现在我想要使用linqtoxml在一个查询中使用property1,其部分名称为“B”,子部分名称为“B”,内部部分名称为“B”。 最佳答案 这是我的看法,替代Jon的看法,假设Property1仅在内部部分出现一次,而您只需要那个:varProperty1=doc.Root.Elements("local").Elements("section").Where(x=>x.Attribute("name")=="B").Elements("subsection").Where(x=>x.Attribute("name"