Remove First Entry in Fixed Array
Here is a quick little trick for removing the first entry in a fixed size array. This can be used when you receive the error message: Exception calling “RemoveAt” with “1” argument(s): “Collection was of a fixed size.” # Remove first entry $array = $array[1..($array.Length-1)]
Single object array
[System.Collections.ArrayList] $ArrStrings = @() $ArrStrings.Add("string") | Out-Null
Standard PowerShell Object Array
[System.Collections.Generic.List[PSObject]] $arr = @() $arr.Add($objectA) $arr.Add($objectB)