C# 如何使用Linq to XML获取这些XML值?
我想要一个查询,该查询将返回一个IEnumerable字符串,其中包含 “as.m3” 'as.m4' 我尝试了C# 如何使用Linq to XML获取这些XML值?,c#,xml,linq,linq-to-xml,C#,Xml,Linq,Linq To Xml,我想要一个查询,该查询将返回一个IEnumerable字符串,其中包含 “as.m3” 'as.m4' 我尝试了xDoc.Elements(“moduleid”)和xDoc.degents(“moduleid”) 不走运 <?xml version="1.0" encoding="UTF-8"> <root> <code>M11088MUBWWLSRSV9LTJBH81QT</code> <moduleid>as.m3&
xDoc.Elements(“moduleid”)
和xDoc.degents(“moduleid”)
不走运
<?xml version="1.0" encoding="UTF-8">
<root>
<code>M11088MUBWWLSRSV9LTJBH81QT</code>
<moduleid>as.m3</moduleid>
<moduleid>as.m4</moduleid>
</root>
使用:
或:
使用:
或:
xDoc.Descendants("moduleid").Select(x => (string)x);
xDoc.Root.Elements("moduleid").Select(x => (string)x);