Issue
I am trying to reconstruct an array from the parts that constitute it but I am failing to obtain the same result. I instead end up with a single-dimension array with all the values from the respective arrays.
Question
How can I make sure that $brray
is populated with the individual arrays and not only the values that they contain?
MWE
$array = @(("a1","a2"),("b1","b2"))
$a = @("a1","a2")
$b = @("b1","b2")
$brray = @()
$brray += $a
$brray += $b
function test(){
Param(
[string[]]
$array
)
return $array
}
test($array)
test($brray)
Output
$array
a1 a2
b1 b2
$brray
a1
a2
b1
b2