You cannot do this.
When adding restrictions to a generic type, you can specify only one class, and the others should be interfaces.
This is a valid limitation -
public void Foo<T>(int param) where T: MyClass1, IInterface1, IInterface2
But not this
public void Foo<T>(int param) where T: MyClass1, MyClass2
This is logical because when you declare a variable of type Foo, for example Foo<MyType> , your MyType can be derived from MyClass1 , IInterface1 and MyInterface2 , but it cannot be obtained from both MyClass1 and MyClass2 .
source share