码迷,mamicode.com
首页 > 其他好文 > 详细

linq in not in

时间:2014-09-10 17:31:20      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:ar   sp   on   c   r   bs   rom   select   list   

1、not in:lstDown中的DownID属性值不在lstDownfb中的DownID

var  lstDown2 = (from d in lstDown
                          where !(from d2 in lstDownfb select d2.DownID).Contains(d.DownID)
                          select d).ToList();

2、in:lstDown中的DownID属性值在lstDownfb中的DownID

var  lstDown2 = (from d in lstDown
                          where (from d2 in lstDownfb select d2.DownID).Contains(d.DownID)
                          select d).ToList();

linq in not in

标签:ar   sp   on   c   r   bs   rom   select   list   

原文地址:http://www.cnblogs.com/DJYBlog/p/3964746.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!