title: PowerShell Remove item [0] from an array
body: <p>I'm struggling a bit to remove the first line (item ID) of an array.</p>
  
  <pre><code>$test.GetType()
  
  IsPublic IsSerial Name                                     BaseType                                                                                                      
  -------- -------- ----                                     --------                                                                                                      
  True     True     Object[]                                 System.Array
  </code></pre>
  
  <p>To list all the options I tried <code>,$test | gm</code> and it clearly states:</p>
  
  <pre><code>Remove         Method                void IList.Remove(System.Object value)                                                                                              
  RemoveAt       Method                void IList.RemoveAt(int index)
  </code></pre>
  
  <p>So when I try <code>$test.RemoveAt(0)</code> I get the error:</p>
  
  <pre><code>Exception calling "RemoveAt" with "1" argument(s): "Collection was of a fixed size."At line:1 char:1
  + $test.RemoveAt(1)
  + ~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : NotSupportedException
  </code></pre>
  
  <p>So I finally found <a href="http://www.jonathanmedd.net/2014/01/adding-and-removing-items-from-a-powershell-array.html" rel="noreferrer">here</a> that my array needs to be of the type <code>System.Object</code> to be able to use <code>$test.RemoveAt(0)</code>. Is it best practice to declare all the arrays in the beginning of the script as a list? Or is it better to convert the arrays with <code>$collection = ({$test}.Invoke())</code> to a list later on when this functionality is needed?</p>
  
  <p>What are the pro's and cons of both types? Thank you for your help.</p>