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?
When using .FromCache() on an IQueryable result set, should I additionally call .ToList() ,
Share
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
FromCacheimplementation, you will see the that thequery.ToList()is already called. This means that the evaluated list is what is cached. So,You do NOT need to call
ToList()