Say I have a basic interface managed by generics:
public interface Inteface<T> {
void Foo(T t);
}
Now I have a specific implementation of this interface, which is also common:
public class InterfaceImpl<T> {
public void Foo(T t) {
}
}
This looks fine, but now let's say I have a different class:
public class Ololo {
public void BadFunction<TShouldModelInterface>(TShouldModelInterface shouldModelInterface) {
}
}
And let me say that I want to perform a check if it TShouldModelInterfaceactually implements any of the possible ones Interface<T>.
If the interface was not shared, I would just write something like where TShouldModelInterface : Interface.
But is there a way to solve this problem if the interface is declared as Interface<T>?
source
share