Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post


By default, LINQ uses deferred query execution, means when you declare or write a LINQ query it doesn't execute. LINQ queries execute when you we use the query results.


//Query doesn’t execute here

var query = from designation inSampleDbContext.Designation
where designation.Title == "Software Engineer"
select designation;

// Query executes here
 foreach (var designation in query)

Deferred execution advantages:

1.  The main benefit is that deferred query execution allows filtering operations with some in LINQ query itself.

2. It avoids unnecessary query execution reason it improves performance.

3. Query construction and Query execution are decoupled, so we can create the LINQ query in several steps.

4. A deferred execution query is reevaluated when you re-enumerate – hence we always get the latest data.


Some advantages I added using following reference

Share your answer

Share as a guest

Please subscribe me to the CodeChef4U.

By creating your new answer, you agree to the privacy policy and terms of service.