【发布时间】:2011-04-19 14:35:11
【问题描述】:
我正在开发一个 Windows Phone 7 应用程序。
我有一个表中的 Id 列表,我想过滤一个包含有关这些表的所有信息的 XML 文件。
我有以下 C# 代码:
var filteredData =
from c in loadedData.Descendants("gameDescription")
where c.Attribute("gameType").Value == gameType &&
c.Attribute("language").Value.Equals(language)
select new SampleData.GamesDesc()
{
Id = uint.Parse(c.Attribute("game_id").Value),
. . .
};
如果我有List<long> unfinishedGamesId。我想从 unfinishedGamesId 中获取所有没有 Id 的游戏的结果。比如:
c.Attribute("game_id").Value != unfinishedGamesId[0] &&
c.Attribute("game_id").Value != unfinishedGamesId[1] &&
...
如何将它添加到 where 子句中?
【问题讨论】:
标签: windows-phone-7 linq-to-xml where-clause