Spock
Spock

Reputation: 6992

Does LINQ to Objects caching?

Does LINQ to Objects queries cache by LINQ provider when it execute for the second time?

Upvotes: 4

Views: 325

Answers (2)

Mutex
Mutex

Reputation: 446

No it doesn't. Because linq to objects it is just extensions that roll your enumerable into another enumerable or execute it immediately. It is easier to understand how linq works by reading this article.

Upvotes: 0

Marcelo Cantos
Marcelo Cantos

Reputation: 185922

There is nothing to cache in LINQ-to-Objects, which simply uses a series of extension method calls to generate a chain (or graph) of iterators. It isn't like LINQ-to-SQL, which has to compile the graph into a SQL statement before executing it.

Upvotes: 3

Related Questions