Here's how you can find duplicates in a list in CSharp using LINQ:
main.cs231 chars7 lines
Explanation:
myList with some duplicates.GroupBy method to group the elements of the list by their values.Where method to filter the groups to only those that have a count greater than 1 (i.e., the duplicates).Select method to select the key of each duplicate group (i.e., the duplicated value).gistlibby LogSnag