PowerShell: Join Array, Append

By Xah Lee. Date: . Last updated: .

🛑 WARNING: Array type is optimized for not changing size. It has to recreate the array and is slow. The more items in a array, the slower it is to change size.

Append an Item

Use operator += to add a item to end of array.

$x = 1, 2, 3
# add a item "b" to the end
$x += "b"
$x

Join Arrays

use + operator.

$a = 1,2
$b = 3,4,5
$a+$b

PowerShell: Array