Using LINQ to Objects to find items in one collection that do not match another

后端 未结 8 1870
清酒与你
清酒与你 2020-12-29 05:04

I want to find all items in one collection that do not match another collection. The collections are not of the same type, though; I want to write a lambda expression to spe

8条回答
  •  一生所求
    2020-12-29 05:49

             var nonManagers = ( from e1 in employees
                                 select e1 ).Except(
                                       from m in managers
                                       from e2 in employees
                                       where m.EmployeeId == e2.Id
                                       select e2 );
    

提交回复
热议问题