All PowerShell versions
Whenever you assign NULL values to array elements, they will count as array elements, but will not be output (after all, they are NULL aka nothing). This can lead to tough debugging situations, so when the size of an array does not seem to match the content, look for NULL values:
$a = @() $a += 1 $a += $null $a += $null $a += 2
1 2 Count: 4
ReTweet this Tip!
Dec 01 2014, 06:00 AM