/ Published in: C#
Snippet to illustrate the three actions that happen in all LINQ query operations.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// The Three Parts of a LINQ Query: // 1. Data source. // 2. Query creation. // numQuery is an IEnumerable<int> var numQuery = from num in numbers where (num % 2) == 0 select num; // 3. Query execution. foreach (int num in numQuery) { Console.Write("{0,1} ", num); }
URL: http://msdn.microsoft.com/en-us/library/bb397906.aspx