Click here to Skip to main content
14,920,539 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();
   

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

  Print Answers RSS
Top Experts
Last 24hrsThis month