我想要像
这样的东西var o = db.Persons.Where(x=>x.Id in (1, 2));
或
var o = db.Persons.Where(x=>x.Id =any (1, 2));
答案 0 :(得分:3)
var o = db.Persons.Where(x=> new[]{1, 2}.Contains(x.Id));
答案 1 :(得分:2)
var keys = new List<int>{1,2,3}; //This contains the collection of your Id
var o = db.Persons.Where(x=>keys.Contains(x.Id));