Export (0) Print
Expand All

7.13.3 Event assignment

Visual Studio .NET 2003

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 (Section 6.1).
  • An event accessor of the event is invoked, with the 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 (Section 8.6).

Show:
© 2014 Microsoft