Pages

Tuesday, January 06, 2009

Linq Deferred Execution

Linq defers the execution of a query until either of the following is encountered:
  • .ToList()
  • foreach
This means that the query is sent to the data source (i.e. SQL Server) only once the code reaches one of the above statements - when the query results are actually needed to be used.

No comments: