Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

Argument lists

User-defined explicit conversions | Anonymous function conversions | Implementation example | Method group conversions | Expression classifications | Static and Dynamic Binding | Dynamic binding | Operator overloading | Candidate user-defined operators | Member lookup |


Читайте также:
  1. A good thesis sentences will control the entire argument.
  2. An Argument and an Arrival
  3. Answer the following questions. Give your arguments.
  4. Argumentative Essay
  5. Arguments for the British system
  6. Asking for details; catalogues, samples, price-lists

Every function member and delegate 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, indexers and delegates, the arguments are specified as an argument-list, as described below. For indexers, when invoking the set accessor, the argument list additionally includes the expression specified as the right operand of the assignment operator.

· 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 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.7), events (§10.8), and user-defined operators (§10.10) are always passed as value parameters (§10.6.1.1). The arguments of indexers (§10.9) are always passed as value parameters (§10.6.1.1) or parameter arrays (§10.6.1.4). Reference and output parameters are not supported for these categories of function members.

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

argument-list:
argument
argument-list, argument

argument:
argument-nameopt argument-value

argument-name:
identifier:

argument-value:
expression
ref variable-reference
out variable-reference

An argument-list consists of one or more arguments, separated by commas. Each argument consists of an optional argument-name followed by an argument-value. An argument with an argument-name is referred to as a named argument, whereas an argument without an argument-name is a positional argument. It is an error for a positional argument to appear after a named argument in an argument-list.

The argument-value can take one of the following forms:

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

· The keyword ref followed by a variable-reference (§5.4), indicating that the argument is passed as a reference parameter (§10.6.1.2). A variable must be definitely assigned (§5.3) before it can 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.6.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.


Дата добавления: 2015-11-16; просмотров: 69 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
Function members| Corresponding parameters

mybiblioteka.su - 2015-2024 год. (0.006 сек.)