Remove Duplicate Entries with exception of the first one

Hi, (@Florent_Salendres)

One way to approach this is to ForEach col In dt.Columns
Then Assign the datatable to remove the duplicates using the solution found here:

So it could be something like this:

ForEach col In dt1.Columns
Assign dataTable = dataTable.AsEnumerable()
.GroupBy(Function(i) i.Field(Of String)(col.ColumnName))
.Select(Function(g) g.First)
.CopyToDataTable

That was just a quick idea I had, but there might be another way to do it without the Loop.

Regards

2 Likes