Imports System.Collections.Generic
Private _name As String = Nothing
Public Property Name As String
Set(ByVal value As String)
Private _serviceGroup As Integer = 0
Public Property ServiceGroup As String
Set(ByVal value As String)
Public Sub New(name as String, serviceGroup as String)
_serviceGroup = serviceGroup
Dim unique1 as Thing = new Thing("test", 1)
Dim unique2 as Thing = new Thing("test1", 1)
Dim unique3 as Thing = new Thing("test", 2)
Dim dup1 as Thing = new Thing("test", 1)
Dim dup2 as Thing = new Thing("test", 1)
Dim things as Thing() = {
Dim duplicates As List(Of Thing) =
GroupBy(Function(thing) New With {Key .Name = thing.Name, Key .ServiceGroup = thing.ServiceGroup }).
Where(Function(group) group.Count() > 1).
SelectMany(Function(group) group.ToList).
For Each thing as Thing in duplicates
Console.WriteLine("{0}:{1}", thing.Name, thing.ServiceGroup)