C# LINQ find duplicates in List

前端 未结 9 1196
星月不相逢
星月不相逢 2020-11-22 07:57

Using LINQ, from a List, how can I retrieve a list that contains entries repeated more than once and their values?

9条回答
  •  孤独总比滥情好
    2020-11-22 08:39

    Linq query:

    var query = from s2 in (from s in someList group s by new { s.Column1, s.Column2 } into sg select sg) where s2.Count() > 1 select s2;
    

提交回复
热议问题