Immediate Query Execution : Deferred Query : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Deferred Query »

 

Immediate Query Execution








    
 

using System;
using System.Linq;

class MainClass {
    static double Square(double n) {
        Console.WriteLine("Computing Square(" + n + ")...");
        return Math.Pow(n, 2);
    }

    public static void Main() {
        int[] numbers = { 1, 2, 3 };
        var query = from n in numbers select Square(n);
        foreach (var n in query.ToList())
            Console.WriteLine(n);
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Deferred Query