Objects with no ‘.Count’ Property – use of @() (array subexpression operator) vs. [Array] cast
In PSv3+, with its unified handling of scalars and collections, any object – even $null – should have a .Count property (and, with the exception of $null, should support indexing with [0]). Any occurrence of an object not supporting the above should be considered a bug; for instance: Using this intrinsic (engine-supplied) .Count property unexpectedly … Read more