PowerShell: Delete Array, Clear Array
Delete Array Variable by Remove-Variable
use
Remove-Variable
to remove the variable.
$x = @(1,2,3) Remove-Variable x
Set Array value to $null
assign $null
to the array.
this is an effective way to remove the array.
$x = 1,2,3 $x = $null $x
Clear Array, Reset All Items
array.Clear()
Sets all item values to the default value of the array's item type.
$x = 0, 1, 2, "some" $x.Clear() Write-Host ($x.length -eq 4) # True
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 (where)
- PowerShell: Delete Array, Clear Array
- PowerShell: Array to String
- PowerShell: Array Methods
- PowerShell: Iterate Array