Create deferred Query Execution with external method in CSharp
Description
The following code shows how to create deferred Query Execution with external method.
Example
using System;//from w w w .j av a 2 s.co m
using System.Linq;
class MainClass {
static double Square(double 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)
Console.WriteLine(n);
}
}
The code above generates the following result.