Better conversion target
Given two different types T1 and T2, T1 is a better conversion target than T2 if at least one of the following holds: · An implicit conversion from T1 to T2 exists, and no implicit conversion from T2 to T1 exists · T1 is a signed integral type and T2 is an unsigned integral type. Specifically: o T1 is sbyte and T2 is byte, ushort, uint, or ulong o T1 is short and T2 is ushort, uint, or ulong o T1 is int and T2 is uint, or ulong o T1 is long and T2 is ulong Overloading in generic classes 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<T> {...} interface I2<T> {...} class G1<U> void F2(I1<U> a); // Valid overload class G2<U,V> void F4(U u, I1<V> v); // Valid, but overload resolution for void F5(U u1, I1<V> v2); // Valid overload void F6(ref U u); // valid overload
|