Reputation: 614
How can I implement generic interface that restrict a type of interface that is generic?
interface A<T>
interface B<T> where T: class
I need the interface A<> to be restricted to interface B with any class type
I am thinking that it may look something like
interface A<T> where T : B<T>
or
interface A<B<T>> where T : class
but both doesnt seem to work
Any solution?
Upvotes: 1
Views: 81
Reputation: 23324
You're overengineering this. Simply do this:
interface A<T> where T : class
{
B<T> SomeProperty { get;}
void SomeMethod(B<T> param);
}
Upvotes: 1