13.07.2015 Views

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>C#</strong> LANGUAGE SPECIFICATIONConstruct Example DescriptionInstanceconstructorinvocationend note]new T(x, y)Overload resolution is applied to select the best instanceconstructor in the class or struct T. The instance constructor isinvoked with the argument list (x, y).14.4.1 Argument listsEvery function member invocation includes an argument list, which provides actual values or variablereferences for the parameters of the function member. The syntax for specifying the argument list of afunction member invocation depends on the function member category:• For instance constructors, methods, and delegates, the arguments are specified as an argument-list, asdescribed below.• For properties, the argument list is empty when invoking the get accessor, and consists of theexpression 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 theindexer access. When invoking the set accessor, the argument list additionally includes the expressionspecified 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 thetwo operands of the binary operator.The arguments of properties (§17.6), events (§17.7), and user-defined operators (§17.9) are always passed asvalue parameters (§17.5.1.1). The arguments of indexers (§17.8) are always passed as value parameters(§17.5.1.1) or parameter arrays (§17.5.1.4). Reference and output parameters are not supported for thesecategories of function members.The arguments of an instance constructor, method, or delegate invocation are specified as an argument-list:argument-list:argumentargument-list , argumentargument:expressionref variable-referenceout variable-referenceAn argument-list consists of one or more arguments, separated by commas. Each argument can take one ofthe following forms:• An expression, indicating that the argument is passed as a value parameter (§17.5.1.1).• The keyword ref followed by a variable-reference (§12.3.3), indicating that the argument is passed as areference parameter (§17.5.1.2). A variable must be definitely assigned (§12.3) before it can be passedas a reference parameter. A volatile field (§17.4.3) cannot be passed as a reference parameter.• The keyword out followed by a variable-reference (§12.3.3), indicating that the argument is passed asan output parameter (§17.5.1.3). A variable is considered definitely assigned (§12.3) following afunction member invocation in which the variable is passed as an output parameter. A volatile field(§17.4.3) cannot be passed as an output parameter.During the run-time processing of a function member invocation (§14.4.3), the expressions or variablereferences of an argument list are evaluated in order, from left to right, as follows:132

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!