February 2019
Intermediate to advanced
626 pages
15h 51m
English
Elements in a list may be removed based on the index or value:
$list = New-Object System.Collections.Generic.List[String]
$list.AddRange([String[]]("Tom", "Richard", "Harry", "David"))
$list.RemoveAt(1) # By Richard by index
$list.Remove("Richard") # By Richard by value
All instances of a particular value may be removed using the RemoveAll method:
$list.RemoveAll( { $args[0] -eq "David" } )
Read now
Unlock full access