Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specification


14 Expressions
14.4 Function members
14.4.2 Overload resolution
14.4.2.3 Better conversion
Paragraph 11 Given an implicit conversion C1 that converts from a type S to a type T1, and an implicit conversion C2 that converts from a type S to a type T2, the better conversion of the two conversions is determined as follows: - 2 If T1 and T2 are the same type, neither conversion is better.
- 3 If S is T1, C1 is the better conversion.
- 4 If S is T2, C2 is the better conversion.
- 5 If an implicit conversion from T1 to T2 exists, and no implicit conversion from T2 to T1 exists, C1 is the better conversion.
- 6 If an implicit conversion from T2 to T1 exists, and no implicit conversion from T1 to T2 exists, C2 is the better conversion.
- 7 If T1 is sbyte and T2 is byte, ushort, uint, or ulong, C1 is the better conversion.
- 8 If T2 is sbyte and T1 is byte, ushort, uint, or ulong, C2 is the better conversion.
- 9 If T1 is short and T2 is ushort, uint, or ulong, C1 is the better conversion.
- 10 If T2 is short and T1 is ushort, uint, or ulong, C2 is the better conversion.
- 11 If T1 is int and T2 is uint, or ulong, C1 is the better conversion.
- 12 If T2 is int and T1 is uint, or ulong, C2 is the better conversion.
- 13 If T1 is long and T2 is ulong, C1 is the better conversion.
- 14 If T2 is long and T1 is ulong, C2 is the better conversion.
- 15 Otherwise, neither conversion is better.
Paragraph 21 If an implicit conversion C1 is defined by these rules to be a better conversion than an implicit conversion C2, then it is also the case that C2 is a worse conversion than C1. |
Jagger Software Ltd |
Company # 4070126 |
VAT # 762 5213 42 |

