Find duplicates in List(Of String) in VB.NET

前端 未结 2 942
傲寒
傲寒 2021-01-06 08:10

I have a customers List(of String) on which I am trying to find the duplicate customers.

If Not customers.Count = customers.Distinct.ToList.Coun         


        
2条回答
  •  再見小時候
    2021-01-06 08:34

    customers = customers.GroupBy(Function(m) m) _
                     .Where(Function(g) g.Count() > 1) _
                     .Select(Function(g) g.Key).ToList
    

提交回复
热议问题