LINQ - Find all items in one list that aren't in another list

前端 未结 3 1144
一个人的身影
一个人的身影 2020-12-28 12:01

I\'m stuck with a LINQ query (or any other efficient means of accomplishing the same thing). Can someone show me how I can select all the items in one list that are not pre

3条回答
  •  长发绾君心
    2020-12-28 12:38

    The easiest way is to use the Except method.

    var deletedItems = list1.Except(joinItems);
    

    This will return the set of items in list1 that's not contained in joinItems

提交回复
热议问题