List<Model> strList = new List<Model>()
{
new Model(){Id=1,Name = "张三"},
new Model(){Id=11,Name = "张三1"},
new Model(){Id=2,Name = "李四"},
new Model(){Id=3,Name = "王五"},
new Model(){Id=30,Name = "王五"},
new Model(){Id=4,Name = "赵六"},
};
List<int> whereList = new List<int>() { 1, 3 };
List<Model> list = strList.Where(x => whereList.Contains(x.Id)).ToList();
- 本文标题: Linq 使用in进行查询
- 文章分类:【.NET/Web】
- 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.