Possible Duplicate:
Question about ambiguous calls in C#
I have these two methods:
TypeA MyMethod(string s) {}
TypeB MyMethod(string s) {}
The following call gives me “ambiguity between methods” error:
TypeA ta = MyMethod("some string");
How does this happen when I’m asking for a TypeA object to return explicitly and not via var or otherwise?
TypeA and TypeB are separate classes, they don’t have anything in common.
From the C# spec v4.0, section 1.6.6:
You have two methods with the same signature because they differ only in the return type. This is not allowed.