0
我正在开发Windows Phone 7应用程序。用LinQ过滤XML数据
我有一个表中的Ids列表,我想过滤一个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的游戏都得到Filer结果。例如:
c.Attribute("game_id").Value != unfinishedGamesId[0] &&
c.Attribute("game_id").Value != unfinishedGamesId[1] &&
...
如何将此添加到where子句?
我用更好的细节更新了我的问题。 – VansFannel 2011-04-19 14:42:38
难题...因为你想在列表中没有条目的值,使用“!(unfinishedGamesId.Contains(...))”应该做的伎俩。 – NateTheGreat 2011-04-19 14:45:05