Add thread into thread array <p>Take a look at my code.</p> <pre><code>Thread[] connect_thread; public void thread_runned() { connect_thread = new Thread[dataGridView1.SelectedRows.Count]; for (int index = 0; index &lt; dataGridView1.SelectedRows.Count; index++) { connect_thread[index] = new Thread(new ThreadStart(connect)); connect_thread[index].Start(); } } public void connect() { //performance code here } public void ButtonClick1() { //User select rows 0-4 thread_runned(); } public void ButtonClick2() { //User select rows 5-9 thread_runned(); } </code></pre> <p>According to the code above, when I run it, and click on <code>ButtonClick1</code> and <code>ButtonClick2</code>, it returns two different <code>connect_thread</code>s (see this debug for more detail.)</p> <pre><code>//Debug when ButtonClick1 is running connect_thread = array( [0] = System.Threading.Thread [1] = System.Threading.Thread [2] = System.Threading.Thread [3] = System.Threading.Thread ) //Debug when ButtonClick2 is running connect_thread = Error: Index was outside the bounds of the array. </code></pre> <p>Now, I want to add a new thread item into this thread array, but the indeces must continue like the old thread items (i.e, the next indeces will be <code>[4]</code>, <code>[5]</code>, <code>[6]</code>, etc.)</p> <p>I'm not worrying about this error:</p> <pre><code>//Debug when ButtonClick2 is running connect_thread = Error: Index was outside the bounds of the array. </code></pre> <p>because I can create a list of threads using <code>dataGridView1.Rows.Count</code>, and it will work fine. However, I'm looking to do it the other way other because when the user adds more data into <code>dataGridView</code>, the index will be wrong again.</p> <p>How can I append new threads to the end of my thread array while preserving indeces?</p>