Is there a way to test if T inherits/implements a class/interface?
private void MyGenericClass ()
{
if(T ... inherits or implements some class/i
If you want to check during compilation: Error if if T does NOT implement the desired interface/class, you can use the following constraint
public void MyRestrictedMethod() where T : MyInterface1, MyInterface2, MySuperClass
{
//Code of my method here, clean without any check for type constraints.
}
I hope that helps.