LINQ的Intersect方法
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); });
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); });