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
1.4m articles
1.4m replys
5 comments
57.0k users