mujiansu / morelinq

Automatically exported from code.google.com/p/morelinq
Apache License 2.0
0 stars 0 forks source link

add Memoize support #100

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I didn't see this as an existing issue when searching just now, but morelinq 
seems like a good place for a Memoize extension method.

The goal is to allow callers to iterate over a sequence multiple times, but 
caching the results so the inner/original sequence is still only iterated once.

The most common use case I've seen for this is when interacting with sql 
queries.  If you use ToList/ToArray or the like (as many people do), you end up 
forcing your code to wait until all the results have been pulled into memory 
from the server.  Memoize improves this situation by allowing you to start 
pulling from the queryable immediately, but without having to incur the penalty 
if you end up needing to iterate over it multiple times (as the data gets 
cached as it's been pulled from the source).

An example gist can be found here to get across the idea:

https://gist.github.com/thomaslevesque/3345186

Original issue reported on code.google.com by james.ma...@gmail.com on 1 May 2015 at 2:40

GoogleCodeExporter commented 8 years ago
Should I file this somewhere else or just leave it here until the migration to 
another project host is completed?

Original comment by james.ma...@gmail.com on 4 May 2015 at 3:45

GoogleCodeExporter commented 8 years ago
This issue has been migrated to:
https://github.com/MoreLINQ/morelinq/issues/100
The conversation continues there.
DO NOT post any further comments to the issue tracker on Google Code as it is 
shutting down.
You can also just subscribe to the issue on GitHub to receive notifications of 
any further development.

Original comment by azizatif on 21 Aug 2015 at 6:56