我一直在推入PowerShell中的.NET框架,并且碰到了一些我不明白的东西。这工作得很好:PowerShell通用集合
$foo = New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]"
$foo.Add("FOO", "BAR")
$foo
Key Value
--- -----
FOO BAR
然而,这并不:
$bar = New-Object "System.Collections.Generic.SortedDictionary``2[System.String,System.String]"
New-Object : Cannot find type [System.Collections.Generic.SortedDictionary`2[System.String,System.String]]: make sure t
he assembly containing this type is loaded.
At line:1 char:18
+ $bar = New-Object <<<< "System.Collections.Generic.SortedDictionary``2[System.String,System.String]"
他们都在同一程序,所以我错过了什么?
正如答案中指出的那样,这几乎只是PowerShell v1的一个问题。
有没有任何描述这种语法的参考?我试图从Powershell对象实现BeginInvoke,并在其中的一个重载中使用输入和输出参数。我似乎无法得到正确的声明。 – 2012-06-13 18:05:57