配列 †
連想配列 †
Set †
$set = New-Object System.Collections.Generic.HashSet[object]
$set.Add($someObject) # $someObjectを追加
:
$set.ExceptWith($exceptSet) # $exceptSet に含まれる要素と同じ要素を削除
List †
$list = New-Object System.Collections.Generic.List[string]
$list.Add("a")
$list.Add("b");
$list.Add("c");
$list.Add("d");
$list.Add("e");
$list.Add("a")
$list.Add("a")
$list.Add("a")
$list.AddRange( [string[]]@("e","f","g","h") ) # make sure type match for list
$list.Find({$args -eq "a"}) # return a
$list.Find({$args -ceq "A"}) # nothing return
$list.FindLast({$args[0] -eq "c"})
$list.FindAll({$args[0] -eq "a"}) # find all a
$list | where {$_ -eq "a"}
$list.FindIndex(0,{$args[0] -eq "a"}) # retrun index 0
$list.FindIndex(1,{$args[0] -eq "a"}) # retrun index 5
$list.Remove("a") # delete first a # Remove method for first match item
$list.RemoveAll("a")
$list.RemoveAt(0)
$list.Contains("f") #true
$list.Contains("a") #false
$stringarray = $list.ToArray()
$list.Clear()