[英]Add inherit class on Generic Class
I have generic class like this: 我有这样的通用类:
public class MyClass<T>
where T : class
{
// method in here...
}
And I try to make this class inherit from another class, like this: 我尝试使该类继承自另一个类,如下所示:
public class MyClass<T>
where T : class
: BaseMyClass
{
// method in here...
}
but It didn't work. 但这没用。
Is it possible generic class derived from another class? 是否可以从其他类派生通用类? and how to do that? 以及如何做到这一点?
public class MyClass<T> : BaseMyClass where T : class
{
// method in here...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.