Iterators do [1..]

08.12.2008 - 22:00 (3 years, 1 month, 4 weeks ago)

programming, dotnet, TrivadisContent, LINQ

The following picture probably doesn't surprise you

But as you can see in what is commented out, you can indeed e.g. do

DataSource.Take(10).ToList

Such an iterator then has quite a similarity to Haskell's [1..], the infinite list. Just make sure that you don't pull all elements from the source...