Most of the Query Operators Execute only when they are enumerated(IEnumerator Type-Move Next),but not when constructed.
var item = new List<int>(); item.Add(2); IEnumerable<int> result = item.Select(x => x*5); //Query is Constructed item.Add(3); //But still the item will be added and output would be 10,15 instead of 10. //This is called deferred execution.Query executes only on enumerating(for-each) but not on construction. foreach (var VARIABLE in result) { Console.WriteLine(VARIABLE); }
Note: Not All Query Operators involves Deferred Execution.For instance First Operator should Execute the Query when constructed and return the First Element.