how settlement an enumerator advantage (theoretically) an enormous volume items?
i'm minute formula looks identical this:
public ienumerable<t> unfold<t>(this t seed)
{
while (true)
{
furnish relapse [next (t)object tradition sequence];
}
}
obviously, slight never going return. (the c# compiler silently allows this, while r# gives me warning "function never returns".)
generally speaking, bad settlement yield an enumerator advantage an enormous array items, but sustenance proceed stop enumerating?
are there any special considerations scenario? mem? perf? gotchas?
if always supply an exit condition, options? e.g:
- an vigilant form t represents consummate proud boundary
- a
predicate<t> continue(astakewhiledoes) - a count (as
takedoes) - ...
should rest users job take(...) / takewhile(...) after unfold(...)? (maybe comparison option, given leverages existent linq knowledge.)
would answer doubt differently formula going published open api, presumably as-is (generic) specific doing pattern?
Comments
Post a Comment