LINQ to Objects List Difference

后端 未结 5 1010
有刺的猬
有刺的猬 2021-01-20 20:55

I have two EmailAddress generic lists, I wanted a simple way of just getting all the EmailAddress objects that are in List1 that aren\'t in List2.

I\'m thinking a le

5条回答
  •  逝去的感伤
    2021-01-20 21:30

    You can use the Except linq method:

    var list1 = // First list generation
    var list2 = // Second list generation
    
    var result = list1.Except(list2);
    

提交回复
热议问题