Don’t do that: The following code clean the screen to prevent the output (the index of the item added into the collection) generated by the Add method.
$array = New-Object System.Collections.ArrayList
Do that: In cases like this one, it’s better to use [void] or $null to prevent the output to be displayed.
This code returns an output with “0” (the index of the item added into the collection).
This code returns no output.
$null = $array.Add('Item1')
Note: There is also a cmdlet “Out-Null” but piping to Out-Null is slower.