Is there a “not equal” in a linq join

后端 未结 4 2278
孤街浪徒
孤街浪徒 2020-12-05 04:27

I am trying accomplish the LINQ query below but I need a \"not equal\" instead of equal, so that filteredEmployees has all employees from groupA minus groupB.



        
4条回答
  •  旧时难觅i
    2020-12-05 04:59

    use of this code for decreased server cost :

    The code works very fast compared to other code

            var noExistList = (from n in groupA 
                                    join o in groupA  on n.Id equals o.Id into p
                                    where p.Count() == 0
                                    select n).ToList();
    

    note: groupA is a new list for add.

提交回复
热议问题