Linq之分組聯接

hhw199112發表於2018-06-21
            int[] arr1 = { 32, 3, 432, 543, 23, 5, 634 };
            int[] arr2 = { 64, 4, 8, 3, 3, 6, 23, 5, 2 };
            var query = from val in arr1 join val2 in arr2 on val equals val2 into temp select new { val, temp };
            foreach (var item in query)
            {
                Console.WriteLine(item.val);
                foreach (var i in item.temp)
                {
                    Console.WriteLine("---------------" + i);
                }
            }

相關文章