Wednesday, 14 August 2013

Find duplicate items in list based on particular member value

Find duplicate items in list based on particular member value

How can I find duplicate items in list based on particular value and group
the duplicated items together?
If I have items that have same email address, I want them to be collected
as duplicates because I use email address as "primary key" in the
collection. Not all values are same in these items.
For example:
var numberOfTestcasesWithDuplicates =
Customers.GroupBy(x =>
x.emailaddress).ToList();
Would give me a collection of duplicated items, but then I want to collect
the duplicated items into grouped collections where I can managed these
items and see what items are duplicated?
Thank you

No comments:

Post a Comment