PowerShell array of arrays:
[string[][]] $array = @(
,@('one', 'two')
,@('three', 'four')
)
$array.ForEach({$_.GetType().Name, $_.Length, ($_ -join '-')})
The result is, as expected :
String[] # first item is a string array
2 # has 2 elements
one-two # one and two
String[] # second item is a string array
2 # has 2 elements
three-four# three and four
But if we do not separate the arrays with a new line :
[string[][]] $array = @(
,@('one', 'two'), @('three', 'four')
)
The output becomes:
String[] # there are still 2 arrays
1 # but the first one has now only 1 element
one two # the two expected elements got concatenated into 1
String[] # second array is ok
2
three-four
Why is that ?
PSVersion 5.1.18298.1000