我想要一个查询,它会返回一个 IEnumerable 字符串,里面有
'as.m3' 'as.m4'
我已经尝试过 xDoc.Elements("moduleid")
和 xDoc.Descendents("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);
关于c# - 如何使用 Linq to XML 获取这些 XML 值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18339352/