Skip to content

Commit 725cd39

Browse files
committed
Add anonymous functions
nameof also can be used with anonymous function parameters.
1 parent e4a4a0e commit 725cd39

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎standard/basic-concepts.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,8 @@ The ***scope*** of a name is the region of program text within which it is possi
792792
- The scope of a parameter declared in an *indexer_declaration* ([§15.9](classes.md#159-indexers)) is the *indexer_body* of that *indexer_declaration*.
793793
- The scope of a parameter declared in an *operator_declaration* ([§15.10](classes.md#1510-operators)) is the *operator_body* of that *operator_declaration*.
794794
- The scope of a parameter declared in a *constructor_declaration* ([§15.11](classes.md#1511-instance-constructors)) is the *constructor_initializer* and *block* of that *constructor_declaration*.
795-
- With the exception of discard parameters ([§12.22.2](expressions.md#12222-anonymous-function-signatures)), the scope of a parameter declared in a *lambda_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *lambda_expression_body* of that *lambda_expression*.
796-
- With the exception of discard parameters ([§12.22.2](expressions.md#12222-anonymous-function-signatures)), the scope of a parameter declared in an *anonymous_method_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *block* of that *anonymous_method_expression*.
795+
- With the exception of discard parameters ([§12.22.2](expressions.md#12222-anonymous-function-signatures)), the scope of a parameter declared in a *lambda_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *lambda_expression_body* of that *lambda_expression* and `nameof` expressions in an attribute on the anonymous function or its parameters.
796+
- With the exception of discard parameters ([§12.22.2](expressions.md#12222-anonymous-function-signatures)), the scope of a parameter declared in an *anonymous_method_expression* ([§12.22](expressions.md#1222-anonymous-function-expressions)) is the *block* of that *anonymous_method_expression* and `nameof` expressions in an attribute on the anonymous function or its parameters.
797797
- The scope of a label declared in a *labeled_statement* ([§13.5](statements.md#135-labeled-statements)) is the *block* in which the declaration occurs.
798798
- The scope of a local variable declared in a *local_variable_declaration* ([§13.6.2](statements.md#1362-local-variable-declarations)) is the *block* in which the declaration occurs.
799799
- The scope of a local variable declared in a *switch_block* of a `switch` statement ([§13.8.3](statements.md#1383-the-switch-statement)) is the *switch_block*.

‎standard/classes.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ A *parameter_array* may occur after an optional parameter, but cannot have a def
23232323
>
23242324
> *end example*
23252325
2326-
A method declaration creates a separate declaration space ([§7.3](basic-concepts.md#73-declarations)) for parameters and type parameters. Names are introduced into this declaration space by the type parameter list and the parameter list of the method. Names are also introduced into this declaration space by the type parameter list and the formal parameter list of the method in `nameof` expressions in attributes placed on the method or its parameters. The body of the method, if any, is considered to be nested within this declaration space. It is an error for two members of a method declaration space to have the same name.
2326+
A method declaration creates a separate declaration space ([§7.3](basic-concepts.md#73-declarations)) for parameters and type parameters. Names are introduced into this declaration space by the type parameter list and the parameter list of the method. These names are also in scope within `nameof` expressions in attributes placed on the method or its parameters. The body of the method, if any, is considered to be nested within this declaration space. It is an error for two members of a method declaration space to have the same name.
23272327
23282328
A method invocation ([§12.8.10.2](expressions.md#128102-method-invocations)) creates a copy, specific to that invocation, of the parameters and local variables of the method, and the argument list of the invocation assigns values or variable references to the newly created parameters. Within the *block* of a method, parameters can be referenced by their identifiers in *simple_name* expressions ([§12.8.4](expressions.md#1284-simple-names)). Within a `nameof` expression in attributes placed on the method or its parameters, formal parameters can be referenced by their identifiers in *simple_name* expressions.
23292329

0 commit comments

Comments
 (0)