Linq兩個from查詢條件

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 query1 = from val in arr1 from val2 in arr2 where val % val2 == 0 group val by val2;
            foreach (var item in query1)
            {
                Console.WriteLine(item.Key);
                foreach (var i in item)
                {
                    Console.WriteLine("------------------" + i);
                }
            }

相關文章