I have already posted about Deferred Execution hereIn this article we will see the internals of Deferred or Lazy Execution of LINQ. Deferred Execution executes the query only when a loop starts. What I mean here is that, we iterate through the query variable to get the result. Here the result variable does not contain the actual result. To get the result, we may iterate through the result (query) variable in a loop as many times as we want. We do deferred execution mainly when multiple values are being returned from the query. Deferred execution can be avoided
Dhananjay kumar is 6 times Microsoft MVP, 7 times C# Corner MVP. He works as consultant for Infragistics in India. He is known for mentoring teams on various technologies.
C# Corner. All contents are copyright of their authors.