【发布时间】:2011-05-13 14:55:31
【问题描述】:
如何在 Powershell 中调用自定义类的通用静态方法?
给定以下类:
public class Sample
{
public static string MyMethod<T>( string anArgument )
{
return string.Format( "Generic type is {0} with argument {1}", typeof(T), anArgument );
}
}
这被编译成一个程序集 'Classes.dll' 并像这样加载到 PowerShell 中:
Add-Type -Path "Classes.dll"
调用 MyMethod 方法最简单的方法是什么?
【问题讨论】:
标签: c# powershell generics powershell-2.0