I have a generic class, but I want my type to be forced to inherit from either one or the other interface. For example:
public class MyGeneric<T> where T : IInterface1, IInterface2 {}
The above will force T to inherti from both IInterface1 and IInterface2 but can I force T to inhert from IInterface1 OR IInterface2 (or both)?
Define a base interface — it doesn’t even have to have any members and let both Interface1 and Interface2 extend it. Then scope T to be of the base interface type. This only works if you want to have the generic derive from your interfaces, not any of the existing ones in the framework.