Is there a way to test if T inherits/implements a class/interface?
private void MyGenericClass () { if(T ... inherits or implements some class/i
There is a Method called Type.IsAssignableFrom().
To check if T inherits/implements Employee:
T
Employee
typeof(Employee).IsAssignableFrom(typeof(T));
If you are targeting .NET Core, the method has moved to TypeInfo:
typeof(Employee).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())