Remove duplicate rows in Datatable

27 05 2011

It’s been long time for my blog with technical posts. So, today, I decided to write on “Remove duplicate datarows in datatable” before I start on Entity Framework 4.1, Azure and Silverlight 4.

DataTable dt = getDataTable();
dt = dt.AsEnumerable().Distinct(DataRowComparer.Default).CopyToDataTable();

Now you’re done.

You can check row count before removing duplicates.








Follow

Get every new post delivered to your Inbox.