[转载]获取2个集合List<T>的共同元素
List<int> a = new List<int> { 1, 2, 3, 4, 5, 6 };
List<int> b = new List<int> { 1, 21, 13, 14, 15, 61 };
List<int> c = a.Intersect(b).ToList();
foreach (var item in c)
{
Console.WriteLine(item);
}
浙公网安备 33010602011771号