Difference between two lists

前端 未结 12 1365
无人共我
无人共我 2020-11-22 13:19

I Have two generic list filled with CustomsObjects.

I need to retrieve the difference between those two lists(Items who are in the first without the items in the sec

12条回答
  •  情书的邮戳
    2020-11-22 13:58

    If both your lists implement IEnumerable interface you can achieve this using LINQ.

    list3 = list1.where(i => !list2.contains(i));
    

提交回复
热议问题