找到兩個集合中交集部分:
source code:
IEnumerable<int> a = new List<int>{
{ 3 }, { 5 }, { 7 }
};
IEnumerable<int> b = new List<int> {
{ 5 }, { 6 }, { 9 }
};
IEnumerable<int> result = a.Intersect(b);
result.ForEach(delegate (int n)
{
Write(n);
});