title: In what conditions does powershell unroll items in the pipeline?
body: <p>Consider the following:</p>
  
  <pre><code>function OutputArray{
      $l = @(,(10,20))
      $l
  }
  
  (OutputArray) -is [collections.ienumerable]
  # C:\ PS&gt; True
  (OutputArray).Count
  # C:\ PS&gt; 2
  </code></pre>
  
  <p><code>$l</code> <a href="https://stackoverflow.com/q/695474/1404637">is "unrolled" when it enters the pipeline</a>.  <a href="https://stackoverflow.com/a/695483/1404637">This answer states that powershell unrolls all collections</a>.  <a href="https://msdn.microsoft.com/en-us/library/system.collections.hashtable%28v=vs.110%29.aspx" rel="nofollow noreferrer">A hashtable is a collection</a>.  However, a hashtable is of course unaffected by the pipeline:</p>
  
  <pre><code>function OutputHashtable{
      $h = @{nested=@{prop1=10;prop2=20}}
      $h
  }
  
  (OutputHashtable) -is [collections.ienumerable]
  # C:\ PS&gt; True
  (OutputHashtable).Count
  # C:\ PS&gt; 1
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/695474/powershell-converts-values-returned-from-function-how-to-avoid-this#comment1681096_695474">This comment suggests that it is all IEnumerable that are converted to object arrays</a>.  However, both array and hashtable are ienumerable:</p>
  
  <pre><code>@(,(10,20)) -is [collections.ienumerable]
  #True
  @{nested=@{prop1=10;prop2=20}} -is [collections.ienumerable]
  #True
  </code></pre>
  
  <p>What, exactly, are the conditions where powershell "unrolls" objects into the pipeline?</p>