I'm trying determine if it's possible in C# to have a generic class that inherits from another class such as:
public class MySubclass<T> : SomeClass
But this time, I want to put a constraint on T
being of some [other] base class like so:
public class My开发者_运维百科Subclass<T> where T : TBaseClass
Is it possible to combine these two? Thanks.
The question is slightly unclear, but I think you want:
public class MySubclass<T> : SomeClass where T : TBaseClass { }
精彩评论