When using .FromCache()
on an IQueryable
result set, should I additionally call .ToList()
, or can I just return the IEnumerable<>
returned by the materialized query with FromCache?
I am assuming you are using a derivative of the code from http://petemontgomery.wordpress.com/2008/08/07/caching-the-results-of-linq-queries/ . If you look at the FromCache
implementation, you will see the that the query.ToList()
is already called. This means that the evaluated list is what is cached. So,
You do NOT need to call ToList()