Question on modifying this custom iterator
<p>I have the below code, which iterates over a list based on a custom algorithm: </p>

<pre><code>        public static IEnumerable&lt;TItem&gt;
MakeCustomIterator&lt;TCollection, TCursor, TItem&gt;(
this TCollection collection, // Extension method of the collection used (eg List&lt;T&gt;)
TCursor cursor, // An array of ints which holds our progress
Func&lt;TCollection, TCursor, TItem&gt; getCurrent,
Func&lt;TCursor, bool&gt; isFinished,
Func&lt;TCursor, TCursor&gt; advanceCursor)
        {
            while (!isFinished(cursor)) // While we haven't reached the end of the iteration......
            {
                yield return getCurrent(collection, cursor);
                cursor = advanceCursor(cursor);

            }

        }


     var matrix = new List&lt;List&lt;double&gt;&gt; {
     new List&lt;double&gt; { 1.0, 1.1, 1.2 },
      new List&lt;double&gt; { 2.0, 2.1, 2.2 },
      new List&lt;double&gt; { 3.0, 3.1, 3.2 }
      };

     var iter = matrix.MakeCustomIterator(
     new int[] { 0, 0 },
     (coll, cur) =&gt; coll[cur[0]][cur[1]],
     (cur) =&gt; cur[0] &gt; 2 || cur[1] &gt; 2,
     (cur) =&gt; new int[] { cur[0] + 1,
       cur[1] + 1 });



            foreach (var item in iter)
            {

            }
</code></pre>

<p>When I use this code, it will get 1.0 and then 2.1 (diagonally below, in the next list). Is it possible to go from 1.0 to 1.1 in the first link? Or possible to go vertically down from 1.0 to 2.0?</p>

<p>Note: This code snippet is from Accelerated C# 2008.</p>

<p>Thanks</p>
