I have a datatable dt which has supplierId and SubsystemId as 2 of its columns . I want to find if there is any duplicate entries for the combination of these two column values .
I am a starter to Linq . How can I do this ?
I have a datatable dt which has supplierId and SubsystemId as 2 of its columns . I want to find if there is any duplicate entries for the combination of these two column values .
I am a starter to Linq . How can I do this ?
You can find your duplicates by grouping your elements by supplierId and SubsystemId. Do a count on them afterwards and you will find which ones are duplicates.
This is how you would isolate the dupes :
var duplicates = items.GroupBy(i => new {i.supplierId, i.SubsystemId})
.Where(g => g.Count() > 1)
.Select(g => g.Key);