moreLinq DistinctBy – Remove Duplicate Record From DataTable Based On Specific ColumnName

0
 Overview: Here in this article I am going to show you how to remove duplicate records from datatable depending upon specific Column-Name. I recommend you to check my previous article (CLICK) where have written how to remove the duplicate record from DataTable without use For loop, Dataview, Array List and delete duplicated over looping etc and delete.

First, of all you need to download MoreLinq Library and import in your project. After Implement morelinq you can use a function called DistinctBy in which you can specify the property on which you want to find Distinct objects.

Duplicate free Datatable using more-linq ( morelinq )

 

OutPut :

DistinctBy Column ID: Here  you can see in output there is only four record which actually we want. i.e. distinct value by ID column

morelinq remove duplicate rows record from datatable asp.net c#

Display all records 

morelinq duplicate rows removed from datatable

If you want to do distinct by 2nd column ie(Name)

Hope you enjoyed this tutorial. If you have any recommendations, please let us know what you think in the comment section below! See you again next time!


Get your Printable Copy

NO COMMENTS

LEAVE A REPLY