Imports System
Imports System.Linq
Public Class Program
Public Shared Sub Main()
Dim arrayOfThings = New String () {"a", "b", "a", "a", "b", "c", "c", "a", "c", "c", "b", "a"}
Dim numberOfTestcasesWithDuplicates = arrayOfThings.GroupBy(Function(x) x).[Select](Function(p) New With { _
Key .item = p.First(), _
Key .count = p.Count() _
})
For Each thing In numberOfTestcasesWithDuplicates
Console.WriteLine(thing.count.ToString() + " instances of " + thing.item.ToString())
Next
End Sub
End Class