Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two list like of different item

List1=ab,bc,ca,bd,kh

List2=bc,ca,kh,kl

I want a list after comparison of list1 and list2.

the output will show all common item like that

List3:bc,ca,kh

can anyone help me to write this code?
Posted
Updated 18-Feb-14 19:19pm
v2

Try this code
SQL
List<string> list3 = (from item in list1
                                  where list2.Contains(item)
                                  select item).ToList();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900