How do you work with dynamic-length arrays (ArrayLists / Lists) in Powershell? I basically want a 2D-array where the length of the outermost index is unknown.
I tried initializing an array with $array = @(), but would get index out of range exceptions when addressing anything in this. Then I tried using the += operand, as I read in an article, but that would result in string concatenation and not element addition.
Example:
$array = @()
$array += @("Elem1x", "Elem1y")
$array += @("Elem2x", "Elem2y")
Echo $array[0][0]
Output: "E" instead of "Elem1x";