首页 > 代码库 > linq in not in

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

linq in not in