找到两个集合中交集部分:

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);
            });

 

相关文章:

  • 2021-08-03
  • 2021-08-01
  • 2021-06-12
  • 2021-09-01
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
猜你喜欢
  • 2022-02-19
  • 2021-10-10
  • 2021-08-18
  • 2022-12-23
  • 2021-07-17
  • 2022-02-02
相关资源
相似解决方案