title: How to use the "CopyTo" method of an ArrayList to another ArrayList object?
body: <p>I would like to know in <strong>C#</strong> or <strong>VB.NET</strong> how to use the <code>CopyTo</code> method of an <code>ArrayList</code> object to copy its contents to other ArrayList (not a simple Array).</p>
  
  <p><strong>Note:</strong> I'm not looking for anything else like the <code>Clone</code> method of the ArrayList or other sugestions, I need to use the <code>CopyTo</code> method to know whether I should discard a problem in other situation.</p>
  
  <p>This is a code example in VB.NET:</p>
  
  <pre><code>Dim ArrayList1 as New ArrayList
  Dim ArrayList2 as New ArrayList
  ArrayList1.Add({"test-Item1-1", "test-Item1-2", "Test-Item1-3"})
  
  
  ' This says that the matrix of the destiny Array is too short.
  ArrayList1.CopyTo(ArrayList2.ToArray)
  
  ' This shows the typical CastIterator exception 'cause LINQ.
  ArrayList1.CopyTo(ArrayList2.Cast(Of Array))
  
  ' This says that the ArrayList can't be converted to an Array.
  ArrayList1.CopyTo(CType(ArrayList2, Array))
  </code></pre>