title: How do I write a PowerShell cmdlet to take either a HashTable or a PODO for input?
body: <p>I have a powershell module that wraps around some web services. The web services take complex Plain Old Dot Net Objects (PODOs) and I have been using <a href="http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx" rel="nofollow">HashTables</a> as in cmdlet parameters and <em><a href="http://technet.microsoft.com/en-us/library/dd315334.aspx" rel="nofollow">New-Object</a> MyPODO -Property $MyHashTable</em> to transform the hashtable into the request object like so</p>
  
  <pre><code>function Get-Stuff ([HashTable]$WhatStuff) {
      $service = New-ServiceProxy . . . .
      $request = New-Object GetStuffRequest -Property $WhatStuff;
      return $service.GetStuff($request);
      $response;
  }
  </code></pre>
  
  <p>However, sometimes I have a cmdlet whose response object can directly become a request object like so:</p>
  
  <pre><code>function Find-Stuff ([HashTable]$KindaStuff) {
      $service = New-ServiceProxy . . . .
      $request = New-Object GetStuffRequest -Property $KindaStuff;
      return $service.SearchStuff($request);
  }
  </code></pre>
  
  <p>Is there some sort of way to decorate the $WhatStuff parameter to accept either a HashTable or a PODO of a particular type?</p>