In System.Interactive.dll (v1.0.2521.0) from Reactive Extensions, EnumerableEx
has both a Memoize
method and a MemoizeAll
method. The API documentation is identical for both of them:
Creates an enumerable that enumerates the original enumerable only once and caches its results.
However, these methods are clearly not identical. If I use Memoize
, my enumerable has values the first time I enumerate it, and seems to be empty the second time. If I use MemoizeAll
then I get the behavior I would expect from the description of either method - I can enumerate the result as many times as I want and get the same results each time, but the source is only enumerated once.
Can anyone tell me what the intended difference between these methods is? What is the use-case for Memoize
? It seems like a fairly useless method with really confusing documentation.
Memoize
. – Heinrike