title: Generic collection as parameters
body: <p>I would like to use a generic collection as a parameter type for a PowerShell function like so:</p>
  
  <pre><code>function Execute-Tokenlist
  {
      param([System.Collections.Generic.List[WTToken]]$Tokenlist)
  
  }
  </code></pre>
  
  <p>[WTToken] is just a custom type.</p>
  
  <p>I create a new generic collection list with WTToken objects:</p>
  
  <pre><code>$TokenList1 = New-Object -TypeName System.Collections.Generic.List[WTToken]
  </code></pre>
  
  <p>But when I try to call the function</p>
  
  <pre><code>Execute-Tokenlist -Tokenlist $TokenList1
  </code></pre>
  
  <p>the result is a ParameterBindingArgumentTransformationException because PowerShell turns System.Collections.Generic.List`1[WTToken] into a new type:</p>
  
  <p>System.Collections.Generic.List`1[[WTToken, TokenListeAuswerten.ps1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]</p>
  
  <p>So it adds the script name as an assembly name to the type name.</p>
  
  <p>My question is: How can I prevent that PowerShell does these kind of type transformation?</p>
  
  <p>I know I could use Object as a parameter type but I don't like giving up type checking for no good reason.</p>