linq in not in

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();

posted on 2014-09-10 16:50  Struggling Rookie  阅读(120)  评论(0编辑  收藏  举报