2013/05/22

#31. LINQ - Find duplicates in a list


After reading some of the Linq Pocket Reference from (O'Reilly) I have become quite the expert in LINQ in my office. A partner asked me how to find if a list has duplicates, that he did a fast search online but could not find a simple answer, so I coded him a simple test that shows us how to find duplicates in a list with LINQ, which you can find below. Also, if you want to check for duplicates in a class list you only need to group by with the field you want to use to find the duplicates, easy as that.

Feel free to ask for more in the comments. Thanks for reading!



No comments:

Post a Comment