Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Latest commit

 

History

History
30 lines (17 loc) · 1.09 KB

query-execution.md

File metadata and controls

30 lines (17 loc) · 1.09 KB

LINQ - lazy and eager execution

Learn to specify either eager or lazy query execution.

Queries execute lazily

The following sample shows how query execution is deferred until the query is enumerated at a foreach statement.

Request eager query execution

The following sample shows how queries can be executed immediately with operators such as ToList().

You can replace the ToList call with a ToArray. Try it.

Reuse queries with new results

The following sample shows how, because of deferred execution, queries can be used again after data changes and will then operate on the new data.

Next: Join operators » Previous: sequence-operations »

Home