日期:2014-05-17  浏览次数:21071 次

如何在循环中拼接 lambda?
C# code


var result = from a in db.Accounts select a;

foreach(int id in ids)
{
    result = result.Where(?)
}




如上,我有多个id希望拼接到linq查询中,请问如何实现?谢谢

------解决方案--------------------
C# code
var result = from a in db.Accounts where ids.Contains(a) select a;