Find the intersection of two lists in linq?

后端 未结 6 490
迷失自我
迷失自我 2020-12-29 01:04

I have list of int A,B. i like to do the following step in linq

list c = new List();

for (int i = 0; i < a.count; i++)
{
    for (i         


        
6条回答
  •  感情败类
    2020-12-29 01:40

    Produce a list c containing all elements that are present in both lists a and b:

    List c = a.Intersect(b).ToList();
    

提交回复
热议问题