You can do something like this.
use linq query to retrieve duplicates as shown below.
And loop through duplicate rows and add rows into duplicate table.
Finally remove duplicates from existing table to get unique rows.
DataTable table=new DataTable();
DataTable Datatableduplicate = table.Clone();
var dupsFromCol = from dr in table.AsEnumerable()
group dr by dr["ID"] into groups
where groups.Count() > 1
select groups;
foreach(var duplicate in dupsFromCol)
{
for(int i=0;i<duplicate.count();i++)>
{
DataRow dr = Datatableduplicate.NewRow();
dr=duplicate.ElementAt(i);
Datatableduplicate.ImportRow(dr);
table.Rows.Remove(dr);
}
}
table will contain unique rows and datatableduplicate contain duplicates rows.