是否有可能创建一个通用的方法与像我可以创建一种类型接口的通用方法吗?
public static string MyMethod<IMyTypeOfInterface>(object dataToPassToInterface)
{
// an instance of IMyTypeOfInterface knows how to handle
// the data that is passed in
}
我将不得不创建(T)Activator.CreateInstance();
接口签名?