Hi i am trying the below requirement.
class:
public class Items
{
public string ID { get; set; }
public string NAME { get; set; }
public string type { get; set; }
}
list1:
ID NAME type
1 aaa 1a
2 bbb 2b
3 ccc 3b
list2:
ID NAME
1a aaa
2b bbb
3c ccc
4d ddd
5e eee
6f fff
Compare the two lists list1 and list2.
i am trying the below query
Compare the two lists list1 and list2.
List<Items> list3= list2.Where(x => list1.Any(z=>x.id==z.type)).ToList();
i am getting the below result for above query:
ID NAME
1a aaa
2b bbb
3c ccc
expected result:
i want the list1 ID, list2 Name where list1.type==list2.ID to form the list3 like below
list3:
ID NAME
1 aaa
2 bbb
3 ccc
Any Help or Suggestion to the above query.
Thanks,
Sudha.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…