Let's suppose I have a class ClassA and a class ClassB, which are both totally different from each other.
For example:
public class ClassA {}
public class ClassB {}
And now I define two methods:
public void Foo<X>(X x) where X : ClassA {}
public void Foo<Y>(Y y) where Y : ClassB {}
As you can see, both Foo methods have the same name, the same return type, and the same amount of arguments. However, each method has a different constraint. Foo<X> can only accept a generic parameter that extends from ClassA, and Foo<Y> can only accept a generic parameter that extends from ClassB.
Nevertheless, the following error is thrown by the compiler:
Type
Testing.Programalready defines a member calledFoowith the same parameter types
As far as I understand, each method accepts different parameter types.
What am I missing?