PowerShell: Array, Set Item
Set Array Element via Syntax
$x = 1, 2, 3 $x[0] = "b" $x # b 2 3
Method: SetValue
or use method SetValue(val, index)
$x = 1, 2, 3 $x.SetValue("b",0) $x
Delete Item
It's not easy to delete array item in PowerShell.
Array data structure is not designed to change size.
Instead of delete, just replace the item by $null
PowerShell: Array
- PowerShell: Array
- PowerShell: Array Sub-Expression Operator @(), Collection to Array
- PowerShell: Array and Types
- PowerShell: Nested Array, Multi-Dimensional Array
- PowerShell: Array, Get Item
- PowerShell: Array, Set Item
- PowerShell: Test If Collection Contains a Value
- PowerShell: Join Array, Append
- PowerShell: Filter Array
- PowerShell: Delete Array, Clear Array
- PowerShell: Array to String
- PowerShell: Array Methods
- PowerShell: Iterate Array