Powershell‎ > ‎

Arrays


Removing Items from an array



Recreate the array without the first [0] item
$arr = 1..5
$arr = $arr[1..($arr.length-1)]
$arr.GetType()
#Create a collection
[System.Collections.ArrayList]$Collection = 1..5
#Create a collection from $arr
$Collection = {$arr}.Invoke{}
[System.Collections.ArrayList]$Collection = $arr
$Collection.GetType()

$arr.IsFixedSize
$Collection.IsFixedSize

now you can add and remove

$Collection.Add(6)
$Collection.Remove(3)
$Collection.RemoveAt(0)






Comments