X hits on this document

1011 views

0 shares

0 downloads

0 comments

131 / 396

C# LANGUAGE SPECIFICATION

for a value parameter or a parameter array, an implicit conversion (§‎6.1) exists from the type of the argument to the type of the corresponding parameter, or

for a ref or out parameter, the type of the argument is identical to the type of the corresponding parameter. After all, a ref or out parameter is an alias for the argument passed.

For a function member that includes a parameter array, if the function member is applicable by the above rules, it is said to be applicable in its normal form. If a function member that includes a parameter array is not applicable in its normal form, the function member may instead be applicable in its expanded form:

The expanded form is constructed by replacing the parameter array in the function member declaration with zero or more value parameters of the element type of the parameter array such that the number of arguments in the argument list A matches the total number of parameters. If A has fewer arguments than the number of fixed parameters in the function member declaration, the expanded form of the function member cannot be constructed and is thus not applicable.

If the class, struct, or interface in which the function member is declared already contains another applicable function member with the same signature as the expanded form, the expanded form is not applicable.

Otherwise, the expanded form is applicable if for each argument in A the parameter passing mode of the argument is identical to the parameter passing mode of the corresponding parameter, and

for a fixed value parameter or a value parameter created by the expansion, an implicit conversion (§‎6.1) exists from the type of the argument to the type of the corresponding parameter, or

for a ref or out parameter, the type of the argument is identical to the type of the corresponding parameter.

7.4.2.2 Better function member

Given an argument list A with a set of argument types { A1, A2, ..., AN } and two applicable function members MP and MQ with parameter types { P1, P2, ..., PN } and { Q1, Q2, ..., QN }, MP is defined to be a better function member than MQ if

for each argument, the implicit conversion from AX to PX is not worse than the implicit conversion from AX to QX, and

for at least one argument, the conversion from AX to PX is better than the conversion from AX to QX.

When performing this evaluation, if MP or MQ is applicable in its expanded form, then PX or QX refers to a parameter in the expanded form of the parameter list.

7.4.2.3 Better conversion

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:

If T1 and T2 are the same type, neither conversion is better.

If S is T1, C1 is the better conversion.

If S is T2, C2 is the better conversion.

If an implicit conversion from T1 to T2 exists, and no implicit conversion from T2 to T1 exists, C1 is the better conversion.

If an implicit conversion from T2 to T1 exists, and no implicit conversion from T1 to T2 exists, C2 is the better conversion.

If T1 is sbyte and T2 is byte, ushort, uint, or ulong, C1 is the better conversion.

If T2 is sbyte and T1 is byte, ushort, uint, or ulong, C2 is the better conversion.

118Copyright Microsoft Corporation 1999-2003. All Rights Reserved.

Document info
Document views1011
Page views1011
Page last viewedFri Dec 09 16:24:12 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments