Skip to content

Use Length property instead of Count #10

@msftrncs

Description

@msftrncs

} elseif ($(if($item -is [Collections.IDictionary]) { $item.get_Keys().Count } else { @($item.psobject.get_Properties()).Count } ) -gt 0) {

On the array obtained from get_Properties(), use Length property, which is the real property, instead of Count which is a PowerShell automatic property.

While there,

foreach ($property in $item.psobject.Properties) {

Should use method get_Properties() instead of property Properties, but possibly optimize by capturing the array returned while counting the number of available properties in the previous invocation.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions