Skip to content

Get-Help about_Pipelines is missing a section for collection #1219

Closed

Description

Issue Details

Get-Help about_Pipelines is missing a section for collection in which it explains that when enumerating objecst to the pipleline we lose the the fact that an object is a collection of size one, e.g.,

following scenarios:

$o = @(1)
$o.GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     Object[]                                 System.Array


$o | % {$_.GetType()}

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     Int32                                    System.ValueType

This affects how the objects from the pipeline are passed to the next command, e.g.,

$o = @(1) 

$o | ConvertTo-Json
1

ConvertTo-Json -InputObject $o
[
  1
]


$o = @(1)
$o | Get-Member
Get-Member -InputObject $o

Version(s) of document impacted

  • Impacts 6 document
  • Impacts 5.1 document
  • Impacts 5.0 document
  • Impacts 4.0 document
  • Impacts 3.0 document

Reason(s) for not selecting all version of documents

  • The documented feature was introduced in selected version of PowerShell
  • This issue only shows up in selected version of the document

Activity

  1. sdwheeler commented on Dec 4, 2017

    @sdwheeler
    Contributor

    This is explained in the topic under the "One-At-A-Time Processing" heading.

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

Metadata

Metadata

Labels

Pri2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions