请问一下大家下面的代码要怎么理解。
public interface IBuilder
{
void Build<T>() where T : class, new();
}
要是不用新语法,普通的代码是什么样的?
------解决方案--------------------
约束
T必须是引用类型,并且有不带参数的 constructor.
------解决方案--------------------
参考:
Constraints on Type Parameters (C# Programming Guide)
http://msdn.microsoft.com/en-us/library/d5x73970.aspx