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