From c7fa8b27cadf56a4f26d5c05f54d0a1bbc1ed78c Mon Sep 17 00:00:00 2001 From: Rex Jaeschke Date: Mon, 20 Nov 2023 14:42:09 -0500 Subject: [PATCH] Add support for Lambda discard parameters --- standard/expressions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/standard/expressions.md b/standard/expressions.md index d2c0df118..7bf732eeb 100644 --- a/standard/expressions.md +++ b/standard/expressions.md @@ -4974,6 +4974,8 @@ The behavior of *lambda_expression*s and *anonymous_method_expression*s is the s ### 12.19.2 Anonymous function signatures +If an *explicit_anonymous_function_parameter_list* or an *implicit_anonymous_function_parameter_list* contains multiple *identifier*s `_`, each of those identifiers denotes a discard ([§9.2.9.1](variables.md#9291-discards)). Otherwise, any single *identifier* `_` denotes a parameter. + The *anonymous_function_signature* of an anonymous function defines the names and optionally the types of the formal parameters for the anonymous function. The scope of the parameters of the anonymous function is the *anonymous_function_body* ([§7.7](basic-concepts.md#77-scopes)). Together with the parameter list (if given) the anonymous-method-body constitutes a declaration space ([§7.3](basic-concepts.md#73-declarations)). It is thus a compile-time error for the name of a parameter of the anonymous function to match the name of a local variable, local constant or parameter whose scope includes the *anonymous_method_expression* or *lambda_expression*. If an anonymous function has an *explicit_anonymous_function_signature*, then the set of compatible delegate types and expression tree types is restricted to those that have the same parameter types and modifiers in the same order ([§10.7](conversions.md#107-anonymous-function-conversions)). In contrast to method group conversions ([§10.8](conversions.md#108-method-group-conversions)), contra-variance of anonymous function parameter types is not supported. If an anonymous function does not have an *anonymous_function_signature*, then the set of compatible delegate types and expression tree types is restricted to those that have no out parameters.