Question

List
I need to filter this list.
I just want to have those person that have the same SalId and those must be at least two.

How do I do it?

Was it helpful?

Solution

var dupSalIdPersons = persons
  .GroupBy(p => p.SalId)
  .Where(g => g.Count() >= 2)
  .SelectMany(g =>  g);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top