it is obvious that you cannot have two [or more] methods that differ only on
returning value:
void F() { }
int F() { }
it is however interesting (and to me : surprizing) that this restriction
also applies to generic methods that differ on constraints:
T F<T>() where T : class { }
T F<T>() where T : struct { }
note that constraints are strictly exclusive here. it would be deterministic
then for the compiler to pick a method to call:
string s = F<string>(); // pick first F
int i = F<int>(); // pick second F
I do not think that this is a compiler-only issue, I belive it is rather
caused by IL limitations. However, since .NET constraints are significantly
limited, I belive it would be easy to determine if constraints are exclusive
or not in general case [Am I wrong?].
Wiktor Zychla