X hits on this document

963 views

0 shares

0 downloads

0 comments

128 / 396

Chapter ‎18   Unsafe code

7.4.1 Argument lists

Every function member invocation includes an argument list which provides actual values or variable references for the parameters of the function member. The syntax for specifying the argument list of a function member invocation depends on the function member category:

For instance constructors, methods, and delegates, the arguments are specified as an argument-list, as described below.

For properties, the argument list is empty when invoking the get accessor, and consists of the expression specified as the right operand of the assignment operator when invoking the set accessor.

For events, the argument list consists of the expression specified as the right operand of the += or -= operator.

For indexers, the argument list consists of the expressions specified between the square brackets in the indexer access. When invoking the set accessor, the argument list additionally includes the expression specified as the right operand of the assignment operator.

For user-defined operators, the argument list consists of the single operand of the unary operator or the two operands of the binary operator.

The arguments of properties (§‎10.6), events (§‎10.7), and user-defined operators (§‎10.9) are always passed as value parameters (§‎10.5.1.1). The arguments of indexers (§‎10.8) are always passed as value parameters (§17.5.1.1) or parameter arrays (§‎10.5.1.4). Reference and output parameters are not supported for these categories of function members.

The arguments of an instance constructor, method, or delegate invocation are specified as an argument-list:

argument-list: argument argument-list   ,   argument

argument: expression ref   variable-reference out   variable-reference

An argument-list consists of one or more arguments, separated by commas. Each argument can take one of the following forms:

An expression, indicating that the argument is passed as a value parameter (§‎10.5.1.1).

The keyword ref followed by a variable-reference (§‎5.4), indicating that the argument is passed as a reference parameter (§‎10.5.1.2). A variable must be definitely assigned (§‎5.3) before it can be passed as a reference parameter. A volatile field (§‎10.4.3) cannot be passed as a reference parameter.

The keyword out followed by a variable-reference (§‎5.4), indicating that the argument is passed as an output parameter (§‎10.5.1.3). A variable is considered definitely assigned (§‎5.3) following a function member invocation in which the variable is passed as an output parameter. A volatile field (§‎10.4.3) cannot be passed as an output parameter.

During the run-time processing of a function member invocation (§‎7.4.3), the expressions or variable references of an argument list are evaluated in order, from left to right, as follows:

For a value parameter, the argument expression is evaluated and an implicit conversion (§‎6.1) to the corresponding parameter type is performed. The resulting value becomes the initial value of the value parameter in the function member invocation.

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

Document info
Document views963
Page views963
Page last viewedThu Dec 08 15:17:28 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments