Is something like this even possible. I want the case, that it executes, when T is MyClass or MyOtherClass.
public T Method<T>()
where T: MyClass, T: MyOtherClass
{ //execution }
CodePudding user response:
This is not possible but you can use an interface for this.
For example:
public interface IMyInterface...
public class MyClass : IMyInterface...
public class MyOtherClass : IMyInterface...
public T Method<T>() where T : IMyInterface...