<Contents>
<Content Book="ABC">
<Item type="New" id="1" File="book1.out"/>
<Item type="Old" id="2" File="book1.out"/>
</Content
</Contents>
在上面的XML我需要得到字符串 「Book1.out」 作爲輸出 有WHERE條件本書=「美國廣播公司」和ID =「1」
如何在LINQ中做到這一點,沒有迭代對結果進行評分。
這是我最初的代碼:
var result = (from query in _configDoc.Descendants("Contents").Descendants("Content")
where query.Attribute("Book").Value == "ABC") select query;
謝謝..
的,什麼是你最初的代碼產生? – 2011-01-05 21:07:48