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.

Advertisement

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.