Skip to content

Measure-Object should support a -All parameter #6278

Description

By default, Measure-Object only returns a value for Count, omitting Average, Sum, Minimum, and Maximum unless those are each specified by analogous parameters.

Given that the perf impact of finding one of those additional values is the same as finding all of them ( O(n) ), we should add a -All parameter that

Steps to reproduce

1,2,3 | Measure-Object -All

Expected behavior

Count    : 3
Average  : 2
Sum      : 6
Maximum  : 3
Minimum  : 1
Property :

Actual behavior

An error is thrown. But without -All, you just get:

Count    : 3
Average  :
Sum      :
Maximum  :
Minimum  :
Property :

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.1
PSEdition                      Core
GitCommitId                    v6.0.1
OS                             Microsoft Windows 10.0.17613
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions