Hi,
From what I understand about the where clause in LINQ, it combines elements from two or more sets based on all possible combinations of each element and then applies the criteria. For example:
public static void Main(string[] args)
{
var setA = new[] {3, 4, 5};
var setB = new[] {6, 7, 8};
var result = from a in setA
from b in setB
let sum = a + b
where sum == 10 // Where, criteria sum == 10.
select new {a, b, sum};
foreach (var element in result)
Console.WriteLine("({0},{1}) == {2}", element.a, element.b, element.sum);
Console.ReadLine();
}
This produces the following results before the where criteria is applied.
3,6 = 9 4,6 = 10 5,6 = 11
3,7 = 10 4,7 = 11 5,7 = 12
3,8 = 11 4,8 = 12 5,8 = 13
The results that match the criteria are 3,7 and 4,6. This produces the results:
(3,7) == 10
(4,6) == 10
However, from what I remember in grade school set theory, is there a way to provide the union of the two sets (pseudocode):
{3, 4, 5} union {6, 7, 8} = {3, 4, 5, 6, 7, 8}
Thanks,
Scott