Reputation: 1
I have a base generic class defined as follows:
public class TheBaseClass<T> where T : Interface1 {}
I have another generic class that I'd like to derive from TheBaseClass. It's defined as follows:
public class SomeClass<T> where T : Interface2 {}
I've looked through the docs, but I can't find an example that compiles. All suggestions will be gratefully received.
Upvotes: 0
Views: 29
Reputation: 236278
When you are inheriting generic base class, you should specify base class constraints for generic type parameter as well:
public class SomeClass<T> : TheBaseClass<T>
where T : Interface1, Interface2
{}
Upvotes: 1