title: Can I use System.Core.dll/System.Collections.Generic.HashSet in powershell?
body: <p>I'd like to use a HashSet in a powershell script. I think I've figured out how to instantiate generic collection objects by doing:</p>
  
  <pre><code>[type] $strType = "string"
  $listClass = [System.Collections.Generic.List``1]
  $listObject = $base.MakeGenericType(@($t))
  $myList = New-Object $setObject
  </code></pre>
  
  <p>This works fine for lists and dictionaries, but when I try to create a HashSet I get:</p>
  
  <pre><code>Unable to find type [System.Collections.Generic.HashSet`1]: make sure that the assembly containing this type is loaded.
  </code></pre>
  
  <p>So it looks like now I need to load System.Core.dll but I can't seem to get powershell to load that assembly. For example calling <em>[System.Reflection.Assembly]::LoadWithPartialName("System.Core")</em> causes this exception:</p>
  
  <pre><code>"LoadWithPartialName" with "1" argument(s): "Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified."
  </code></pre>
  
  <p>Any pointers?</p>