针对于Linq Lambda 查询 中 Contains 用法:
obj. Contains("") 的功能等同于 TSQL中的 Like , in .
!(这里可是是数组,集合等).Contains(obj)
实例如下
List<Student> list = new List<Student>() { new Student() { ID = 1, Name = "A" }, new Student() { ID = 2, Name = "B" }, new Student() { ID = 3, Name = "C" }, new Student() { ID = 4, Name = "D" } };
List<int> ids = new List<int>() { 1, 2 };
List<Student> temp = list.Where(c => !(ids).Contains(c.ID)).ToList<Student>();