针对于Linq Lambda 查询 中 Contains 用法

针对于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>();

转载于:https://my.oschina.net/guanxinsui/blog/919919

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值