PowerShell array is not null

I am trying to understand why this array count

does not result in0

@($null).Count

      

Output:

1

      

+3


source to share


1 answer


@($null)

is an array with one element $null

(hence a property Count

1

). Similarly @($null,$null).Count

- 2

, and @().Count

- 0

. Be aware of what @($null)

emits $null

into the pipeline, so the property Count

returned from @($null) | Measure-Object

will be 0

.



+8


source







All Articles