How to include a table multiple times in Linq query



A table multiple times in Linq query

using System;
using System.Linq;

namespace CSharpLINQ
{
    class SimpleQuery
    {
        static void Main()
        {
            int[] numbers1 = { 10, 20, 30 };
			int[] numbers2 = { -10, -20};

            var posNums = from n in numbers1 from m in numbers2 where n > 0 select new{n, m};
            Console.WriteLine("All Combinations: ");

            // Execute the query and display the results.
            foreach (var obj in posNums) 
				Console.WriteLine(obj.m + "," + obj.n);
        }
    }
}

0 Comment's

Comment Form

Submit Comment