I have a customers List(of String) on which I am trying to find the duplicate customers.
If Not customers.Count = customers.Distinct.ToList.Count Then
customers = customers.Except(customers.Distinct.ToList)
End If
But I get the following exception:
InvalidCastException Unable to cast object of type '<ExceptIterator>d__99`1[System.String]' to type'System.Collections.Generic.List`1[System.String]'.
Is this the right way to find duplicates in a list?