This reminded me of a method that I’ve been planning on presenting here: A simple Counting iterator. Basically, it appears to be a collection filled with a sequences of numbers. For example, the following code will print the number from 20 to 41 stepping by three:
foreach(int i in Iter.Count(20,41, 3))
It’s also good to create an actual collection pre-filled with sequence of numbers:
Also, I should point out that the idea behind this came from a C++ iterator that I first saw presented by Andy Koenig.