is there a way to supress the return value (=Index) of an ArrayList in Powershell (using System.Collections.ArrayList) or should I use another class?
$myArrayList = New-Object System.Collections.ArrayList($null) $myArrayList.Add("test") Output: 0
You can cast to void to ignore the return value from the Add method:
[void]$myArrayList.Add("test")
Another option is to redirect to $null:
$myArrayList.Add("test") > $null
2.1m questions
2.1m answers
60 comments
57.0k users