How LINQ to Objects Works
So far, we’ve been looking at various query expression clauses that enable us to express queries, no matter that data domain we’re targeting. Even though most of our examples assumed in-memory data collections, all those queries would have worked equally well against, say, a relational database.
Because in-memory data is common, it makes sense for us to delve a little deeper into how LINQ support for those data collections is provided. This leads us to a discussion about the
IEnumerator interfaces, iterators, and LINQ to Objects. From this exploration, it will become clear how query expressions are executed lazily and what the implications of this execution model are.