title: re-initialize array
body: <p>How can I re-initialize an array?</p>
  
  <pre><code>public int[] numbers;
  </code></pre>
  
  <p>In my case <code>numbers</code> will be set with an unknown-length array. For example, when I use it first, it will have 8 elements, next time only 5, then 12.</p>
  
  <p>I read some about this topic, and found only one relevant:
  <a href="http://social.msdn.microsoft.com/Forums/en-US/bee99ac8-4ade-40ac-aa78-8d14d1d7bf9f/c-reinitialize-arrays?forum=csharplanguage" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/bee99ac8-4ade-40ac-aa78-8d14d1d7bf9f/c-reinitialize-arrays?forum=csharplanguage</a></p>
  
  <p>Even if I do not care about the memory usage of redeclaration (uhh), I can't make it this way, since I'm going to use the array in a timer's thick method, and gonna use the same array, until the timer stops. Then call the function again, which would put the elements into the array, then start the timer again.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>There are 3 functions in my case and the array declare as a public variable. The first function is called doAction(), which calls another function which returns an array with unknown length. Then, doAction starts the timer1 (thick method), which needs to reach the array from doAction. That's the reason why I used a global variable to put the array in.</p>