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?

有帮助吗?

解决方案

var dupSalIdPersons = persons
  .GroupBy(p => p.SalId)
  .Where(g => g.Count() >= 2)
  .SelectMany(g =>  g);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top