I've been following it quite well, but the author has introduced the idea of using multiple from clauses and doesn't explain how the code gets the output.
The code is
var groupA = new[] { 3, 4, 5, 6 };
var groupB = new[] { 6, 7, 8, 9 };
var someInts = from a in groupA // Required first from clause.
from b in groupB // First clause of query body.
where a > 4 && b <= 8
// Object of anonymous type.
select new { a, b, sum = a + b };
foreach (var a in someInts)
{
Console.WriteLine(a);
}
This outputs:
{ a = 5, b = 6, sum = 11 }
{ a = 5, b = 7, sum = 12 }
{ a = 5, b = 8, sum = 13 }
{ a = 6, b = 6, sum = 12 }
{ a = 6, b = 7, sum = 13 }
{ a = 6, b = 8, sum = 14 }
I have no idea how this outputs the above, I understood the previous examples that used one from clause.
But this has me confused :S
Could someone give me a quick explanation of what's going on here? I don't want to read on without understanding
Thank you for any help.

New Topic/Question
Reply




MultiQuote





|