Link to home
Start Free TrialLog in
Avatar of JElster
JElsterFlag for United States of America

asked on

C# Get Unique DataRows based on 2 columns

Hi..
I have a data taAble with 10 columns... I need to return a data table with the unique values based on COL 1 and COL2 .   Any ideas ?  Maybe Linq?   Need some code examples please.
Avatar of Eyal
Eyal
Flag of Israel image

is that what you are looking for?

var query = (from x in datatable
                    select new(col1 = x.col1, col2 = x.col2)).distinct()

Open in new window

Avatar of JElster

ASKER

I get cannot convert lamba to delegate type
Avatar of JElster

ASKER

Need it just on 2 columns
ASKER CERTIFIED SOLUTION
Avatar of Eyal
Eyal
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial