I’m trying to find duplicates in an array and put only the duplicates in an array.
The code im using is the following
Dim duplicates As List(Of String) = WithDuplicates.GroupBy(Function(n) n) _ .Where(Function(g) g.Count() > 1) _ .Select(Function(g) g.First) _ .ToList() Dim DuplicatesOnly As String() = duplicates.ToArray
WithDuplicates is the Array that contains the duplicates. Before, I used a richtextbox instead of a array but I had to switch to an array because of threading. I don’t know why my code isnt working anymore. Any ideas how I could get this working?
Leave an answer