February 2019
Intermediate to advanced
626 pages
15h 51m
English
As with the array, elements may be selected by index:
$list = New-Object System.Collections.Generic.List[String]
$list.AddRange([String[]]("Tom", "Richard", "Harry"))
$list[1] # Returns Richard
The generic list offers a variety of methods that may be used to find elements when the index is not known, such as the following:
$index = $list.FindIndex( { $args[0] -eq 'Richard' } )
Read now
Unlock full access