dataTable.DefaultView.ToTable(true, "target_column");
- first parameter in
ToTable()
is a boolean which indicates whether you want distinct rows or not. - second parameter in the
ToTable()
is the column name based on which we have to select distinct rows. Only these columns will be in the returned datatable.
If you need to get distinct based on two columns:
dataTable.DefaultView.ToTable(boolean, params string[] columnNames)