RemoveDuplicateRows
This extension method will remove duplicate rows from the DataTable that it is called from.
Source
''' <summary>
''' Removes duplicates from the data table.
''' </summary>
''' <param name="dt"></param>
''' <remarks>
''' This extension method will remove duplicate rows from the DataTable that it is called from.
''' </remarks>
<Extension()> _
Public Sub RemoveDuplicateRows(ByRef dt As DataTable)
Dim columnList(dt.Columns.Count - 1) As String
For counter As Integer = 0 To dt.Columns.Count - 1
columnList(counter) = dt.Columns(counter).ColumnName
Next
dt = dt.DefaultView.ToTable(True, columnList)
End Sub
Example
dt.RemoveDuplicateRows()