Skip to content

Remove type data for System.Array type #3222

@PetSerAl

Description

@PetSerAl

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
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions