Using LINQ to find duplicates across multiple properties

You can find your duplicates by grouping your elements by ValueA and ValueB.
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.ValueA, i.ValueB})
  .Where(g => g.Count() > 1)
  .Select(g => g.Key);

Leave a Comment

techhipbettruvabetnorabahisbahis forumu