title: PowerShell function won't return object
body: <p>I have a simple function that creates a generic List:</p>
  
  <pre><code>function test()
  {
      $genericType = [Type] "System.Collections.Generic.List``1"
      [type[]] $typedParameters = ,"System.String"
      $closedType = $genericType.MakeGenericType($typedParameters)
      [Activator]::CreateInstance($closedType)
  }
  
  $a = test
  </code></pre>
  
  <p>The problem is that <code>$a</code> is always null no matter what I try.  If I execute the same code outside of the function it works properly.  </p>
  
  <p>Thoughts?</p>