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 (as takewhile does)

  • a count (as take does)

  • ...



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

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?