title: Powershell get Get-Measure property value
body: <p>How do I get to the Get-Measure Count property value through piping without surrounding with parenthesises? (Powershell version 5)</p>
  
  <p>I would like something like <code>alias | measure | $_.Count</code>.</p>
  
  <hr>
  
  <h3>TL;DR</h3>
  
  <p>Say I want to count the number of aliases in Powershell so I go</p>
  
  <pre><code>alias | measure | Select-Object -Property Count
  </code></pre>
  
  <p>Which returns a <code>PSCustomObject</code> and not the <code>Int32</code> I was looking for.</p>
  
  <p>Instead I can</p>
  
  <pre><code>alias | measure | foreach { $_.Count }
  </code></pre>
  
  <p>which relies on <code>Get-Measure</code> returning one and only one object. It works for this simple case but is IMO even then ugly.</p>
  
  <p>Another working solution is to </p>
  
  <pre><code>( alias | measure ).Count
  </code></pre>
  
  <p>but I really don't like having to surround with parenthesises, especially when the <code>alias|..|..|..|measure</code> code gets long.</p>
  
  <p>Finally I could</p>
  
  <pre><code>alias | measure | % { $_.Count }
  </code></pre>
  
  <p>which seems to be the best. But the <code>{...}</code> annoys me.<br>
  This latter version is the best so far.</p>