Type data for System.Array type contains single alias property Count -> Length. It was good for consistency, as ICollection.Count is implemented explicitly by arrays and was not visible while other collections types do not have Length property. But since PowerShell v3 it is possible to reference explicitly implemented interface members. So, this alias property no longer necessary. It also cause some headaches with ConvertTo-Json cmdlet:
PS> ConvertTo-Json (,1)
[
1
]
PS> ConvertTo-Json ([PSObject](,1))
{
"value": [
1
],
"Count": 1
}
PS> Remove-TypeData System.Array
PS> ConvertTo-Json (,1)
[
1
]
PS> ConvertTo-Json ([PSObject](,1))
[
1
]
Type data for
System.Arraytype contains single alias propertyCount->Length. It was good for consistency, asICollection.Countis implemented explicitly by arrays and was not visible while other collections types do not haveLengthproperty. But since PowerShell v3 it is possible to reference explicitly implemented interface members. So, this alias property no longer necessary. It also cause some headaches withConvertTo-Jsoncmdlet: