我有一個簡單的功能,創建一個泛型列表:PowerShell的功能將不會返回對象
function test()
{
$genericType = [Type] "System.Collections.Generic.List``1"
[type[]] $typedParameters = ,"System.String"
$closedType = $genericType.MakeGenericType($typedParameters)
[Activator]::CreateInstance($closedType)
}
$a = test
的問題是,$a
總是空不管我怎麼努力。如果我在它正常工作的功能之外執行相同的代碼。
想法?
逗號! D'哦。謝謝,這些日子我會做對的。 – Dan 2010-06-03 05:52:02