1
我的方法定义为如何定义具有两个泛型类型和两个类型约束的方法?
public ActionResult _Create3<T>() where T:IMyClass, new()
,但我想拖定义泛型类型
public ActionResult _Create3<T, G>(G content) where T:IMyClass, new()
G型也必须使用接口ImyClass,但我不在拖车式可知定义!
例如,如果可能会写:
public ActionResult _Create3<T, G>(G content) where {T:IMyClass, G:IMyClass}, new()
,但得到的错误。
感谢答案
一个简单的搜索MSDN中发现了我这一点: http://msdn.microsoft.com/en-us/library/d5x73970.aspx –