about_Pipelines should explain the pipeline's enumeration behavior in more detail #3285
Closed
6 tasks done
Labels
area-engine
Area - PowerShell engine
A core feature of the pipeline is to enumerate collection-like data structures.
The
One-At-A-Time Processing
section ofabout_Pipelines
touches on that, but could use some more detail, notably with respect to what specific data types are considered collections and are therefore enumerated (sent through the pipeline one by one).From what I gather, the rules are:
IEnumerable
interface are automatically enumerated, but there are exceptions:IDictionary
, such as hashtables, are not enumerated, and neither areXmlNode
instances.DataTable
(which doesn't implementIEnumerable
) are enumerated (as the elements of their.Rows
collection)See the source code.
If that is considered too detailed / technical, it's at least worth mentioning that
[hashtable]
instances are not enumerated by default, and that doing so requires a call to.GetEnumerator()
(a fact that already is mentioned in the hash-table-specific topic,about_Hash_Tables
).Additionally it's worth mentioning that (stdout) output from external programs is enumerated line by line in the pipeline.
Version(s) of document impacted
The text was updated successfully, but these errors were encountered: