在Andrew Tolson的《Pro C#》一书中,作者指出当非泛型类继承泛型基类时,派生类必须指定类型参数。
我不理解的是为什么这是必需的?
// Assume you have created a custom
// generic list class.
public class MyList<T>
{
private List<T> listOfData = new List<T>();
}
// Non-generic classes must specify the type
// parameter when deriving from a
// generic base class.
public class MyStringList : MyList<string>
{}
我不理解的是为什么这是必需的?