title: How do I implement a filter in PowerShell?
body: <p>I'm trying to figure out a way to incorporate a filter into a custom function and I haven't been able to get it working:</p>
  
  <pre><code>Function Test-Me{
      Param
      (
        $Filter = "Number -like ""Three"""
      )
  
      $Obj = New-Object PSObject -Properties &amp;{
                                               Number = "One","Two","Three"
                                              }
  
      If($Filter){
       $Obj | Where-Object $Filter
      }else{
       $Obj
      }
  }
  </code></pre>
  
  <p>I've tried various means, but they all fail:</p>
  
  <pre><code>$Filter = 'Where-Object{$_' + $Filter + '}'
  $Obj | &amp; $Filter
  </code></pre>
  
  <p>.</p>
  
  <pre><code>$Filter = "Number -like ""One"""
  $Obj | Where &amp; $Filter
  </code></pre>
  
  <p>How do you incorporate <code>Filter</code> support into custom functions?</p>