score:0

Accepted answer
dim numbers as integer = 3
        dim dt as new data.datatable
        dt.columns.add("date", gettype(datetime))
        for i as integer = 1 to numbers
        dt.columns.add("number" & i, gettype(integer))
        next

    dt.rows.add(new object(){"12/29/2016", "1", "2", "3"})
    dt.rows.add(new object(){"12/30/2016", "4", "2", "3"})
    dt.rows.add(new object(){"12/31/2016", "1", "2", "3"})

    dim d as new system.collections.generic.dictionary(of tuple(of integer, integer, integer), string)
    for each row as data.datarow in dt.rows


    dim t as new tuple(of integer, integer, integer)(row("number1"), row("number2"), row("number3"))

if d.containskey(t) then
        console.writeline("duplicate set of numbers " & d(t) & " " & row("date").tostring())
    else
        d.add(t, row("date").tostring())
        console.writeline("not a duplicate")
    end if



    next

score:0

dt.select(row => new { row = row, id = identifier(row)})
  .groupby(r => r.id)
  .where(g => g.count() > 1)
  .select(g => g.first());

score:0

private iterator function duplicates(of tsource)(byval source as ienumerable(of tsource), byval comparer as iequalitycomparer(of tsource)) as ienumerable(of tsource)

    dim seenelements as new hashset(of tsource)(comparer)
    dim returnedelements as new hashset(of tsource)(comparer)

    for each item in source
        'if adding to the set of seen elements fails, then this element is a duplicate.
        'then, if adding to the set of returned elements succeeds, this element has not been returned before.
        if not seenelements.add(item) andalso returnedelements.add(item) then yield item
    next
end function

Related Query

More Query from same tag