Checking for duplicates in a List of Objects C#

后端 未结 7 694
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 20:35

I am looking for a really fast way to check for duplicates in a list of objects.

I was thinking of simply looping through the list and doing a manual comparison th

7条回答
  •  一生所求
    2020-12-29 21:24

    I think this is what you're looking for:

    List duplicates = dupeList.GroupBy(x => x)
                                       .SelectMany(g => g.Skip(1));
    

提交回复
热议问题