Free mag vol1 | Page 511

CHAPTER 12  LINQ TO OBJECTS Console.WriteLine(); // Change some data in the array. numbers[0] = 4; // Evaluated again! foreach (var j in subset) Console.WriteLine("{0} < 10", j); Console.WriteLine(); ReflectOverQueryResults(subset); } If you were to execute the program yet again, you would find the following output. Notice that the second time you iterate over the requested sequence, you find an additional member, as you set the first item in the array to be a value less than ten: 1 2 3 8 < < < < 10 10 10 10 4 1 2 3 8 < < < < < 10 10 10 10 10 One very useful aspect of Visual Studio is that if you set a breakpoint before the evaluation of a LINQ query, you are able to view the contents during a debugging session. Simply locate your mouse cursor above the LINQ result set variable (subset in Figure 12-2). When you do, you will be given the option of evaluating the query at that time by expanding the Results View option. Figure 12-2. Debugging LINQ expressions 451