Removing elements from the list

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" } ) 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.185.147