Event assignment
If the left operand of a += or -= operator is classified as an event access, then the expression is evaluated as follows:
The instance expression, if any, of the event access is evaluated.
The right operand of the += or -= operator is evaluated, and, if required, converted to the type of the left operand through an implicit conversion (§6.1).
An event accessor of the event is invoked, with argument list consisting of the right operand, after evaluation and, if necessary, conversion. If the operator was +=, the add accessor is invoked; if the operator was -=, the remove accessor is invoked.
An event assignment expression does not yield a value. Thus, an event assignment expression is valid only in the context of a statement-expression (§8.6).
Do'stlaringiz bilan baham: |