...

/

Deferred Execution

Deferred Execution

Learn about when LINQ queries are executed.

Introduction

There are subtleties regarding the timing of LINQ query execution. There are essentially two ways of executing a LINQ query:

  • Deferred execution: The LINQ query only executes when we try to address an item from a resulting collection.

  • Immediate execution: The LINQ query executes immediately after construction.

Let’s explore these in detail.

Deferred execution

There are three ...