I need to copy a collection of 10 items into an array so I can index into it. So I need to use the CopyTo
method and specify a destination array large enough to accommodate the collection.
So before calling CopyTo
I need to dim an empty array of a specific size. I can't seem to find the correct PowerShell syntax for doing this.
This didn't work for me:
$snapshot = New-Object System.Array 10;
New-Object : Constructor not found. Cannot find an appropriate constructor for type System.Array.
Edit
Have worked around it with:
$snapshot = New-Object System.Collections.ArrayList;
$snapshot.AddRange($slider);