While signatures as declared must be unique, it is possible that substitution of type arguments results in identical signatures. In such cases, the tie-breaking rules of overload resolution above will pick the most specific member.
The following examples show overloads that are valid and invalid according to this rule:
interface I1 {...}
interface I2 {...}
class G1
{
int F1(U u); // Overload resulotion for G.F1
int F1(int i); // will pick non-generic
void F2(I1 a); // Valid overload
void F2(I2 a);
}
class G2
{
void F3(U u, V v); // Valid, but overload resolution for
void F3(V v, U u); // G2.F3 will fail
void F4(U u, I1 v); // Valid, but overload resolution for
void F4(I1 v, U u); // G2,int>.F4 will fail
void F5(U u1, I1 v2); // Valid overload
void F5(V v1, U u2);
void F6(ref U u); // valid overload
void F6(out V v);
}
Do'stlaringiz bilan baham: |