i have the following LINQ code which i found in a question on stackoverflow, i want to use it to delete the duplicate rows in the datatable and leave the one with the least index, here is the code and i can’t figure out the code to be added in the commented line
Dim duplicates = From row In GoogleResults.AsEnumerable()
Let seller = row.Field(Of String)("Seller")
Group row By seller Into DuplicateSellers = Group
Where DuplicateSellers.Count() > 1
Select DuplicateSellers
For Each DuplicateSellerRows In duplicates
For Each row In DuplicateSellerRows
'remove current row, but skip the first one
'row.Delete() will remove all rows but how can i keep the first one?
Next
Next
You can use Skip() to skip the first row in each group of duplicates: