A deferred execution query is reevaluated when you reenumerate : Deferred Query : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Deferred Query »

 

A deferred execution query is reevaluated when you reenumerate








    
 

using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
    public static void Main() {

        var numbers = new List<int>() { 1, 2 };

        IEnumerable<int> query = numbers.Select(n => n * 10);
        foreach (int n in query) Console.Write(n + "|"); 

        numbers.Clear();
        foreach (int n in query) Console.Write(n + "|"); 

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Deferred Query