Navaneeth Krishnan
What is deferred execution and immediate execution in LINQ?
By Navaneeth Krishnan in .NET on Aug 23 2020
  • Vikas Garg
    Aug, 2020 25

    Deferred is also known as Lazy Operators. As name suggests, in this Query is not executed at the point of its declaration. It means It executes, when we access the query results.
    Or We can say execution of the query is deferred (lazily loaded) until the query variable is iterated over in a foreach loop. So performance wise it is beneficial.
    E.g. Select, SelectMany etc.

    Immediate is also known as Greedy Operators and just opposite of Deferred. As name suggests, in this Query is executed at the point of its declaration and gets the result immediately.
    E.g. Count, Average,Min, Max

    • 1
  • Sudarshan Hajare
    Aug, 2020 25

    Defered execution means you can write your linq query but result will not come until you iterate the result (eg. foreach loop).

    Immigiate execution is reverse of Deferared execution ,Immigate execution gives us data immigiately.

    • 0

Most Popular Job Functions