From List to Jagged Array : <p>I am trying to convert a <code>List&lt;T&gt;</code> to a <code>Jagged Array T [][]</code>. But each array inside the Jagged Array is repeating the first N Elements of the List. I know that my code is doing exactly that, but how can I iterate over my list in a different way so I dont go through the same N elements?</p>

<p>Please ignore the <code>DataTree&lt;T&gt;</code> type, its just a reference data structure topology to create the Jagged Array.</p>

<pre><code>  public static T[][] ToJaggedArrray&lt;T&gt;(this List&lt;T&gt; data, DataTree&lt;T&gt; dataTree)
        {
            // Get total elements on each row
            //dataTree.DataCount = total elements in data structure
            int totalElementsPerArray = dataTree.DataCount / dataTree.BranchCount;

            // dataTree.BranchCount = number of elemets/rows
            int numElements = dataTree.BranchCount;



            T[][] outPut = new T[numElements][];

            for (int i = 0; i &lt; outPut.Length; i++)
            {
                T[] temp = new T[totalElementsPerArray];

                for (int j = 0; j &lt; temp.Length; j++)
                {
                    temp[j] = data[j];

                }

                outPut[i] = temp;
            }

            return outPut;
        }

/* Output:

54
19
83
80
28
48
46
16
52
38
41
10

Element(0): 54 19 83 80
Element(1): 54 19 83 80
Element(2): 54 19 83 80

*/


/* Expected Output:

54
19
83
80
28
48
46
16
52
38
41
10

Element(0): 54 19 83 80
Element(1): 28 48 46 16
Element(2): 52 38 41 10

*/
</code></pre>
