title: Creating an array with large initial size in powershell
body: <p>The only way I know to create an array in powershell is </p>
  
  <p><code>$arr = @(1, 2, 3)</code></p>
  
  <p>However, this creating method is not convenient if I want to create an array with large initial size such as 10000. </p>
  
  <p>Because I don't want to write code like this</p>
  
  <p><code>$arr = @(0, 0, 0, 0, 0, 0, ... ,0) # 10000 0s in this line of code</code></p>
  
  <p>Writing code like the following is not efficient.</p>
  
  <pre><code>$arr = @()
  for ($i = 1; $i -le 10000; $i++) {
    $arr += 0
  }
  </code></pre>
  
  <p>Because whenever <code>+=</code> operator is executed, all of the elements in the old array would be copied into a newly created array.</p>
  
  <p>What's the best way to create an array with large initial size in powershell?</p>