我想在PowerShell中使用Enumerable.ToList()
。显然,要做到这一点,我必须明确地将对象转换为IEnumerable<CustomType>
,但我无法做到这一点。看来我无法在PowerShell中正确编写IEnumerable<CustomType>
。 IEnumerable<string>
和CustomType
本身都能正常工作(我试图使用的自定义类型叫做WpApiLib.Page
),所以我不知道我能做什么错。IEnumerable <CustomType> in PowerShell
PS C:\Users\Svick> [Collections.Generic.IEnumerable``1[System.String]]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False IEnumerable`1
PS C:\Users\Svick> [WpApiLib.Page]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Page System.Object
PS C:\Users\Svick> [Collections.Generic.IEnumerable``1[WpApiLib.Page]]
Unable to find type [Collections.Generic.IEnumerable`1[WpApiLib.Page]]: make su
re that the assembly containing this type is loaded.
At line:1 char:51
+ [Collections.Generic.IEnumerable``1[WpApiLib.Page]] <<<<
哎哟,真的很丑,谢谢 – svick 2010-03-22 21:18:24