14.13.3 Event assignment

来源:互联网 发布:讲人工智能的电影 编辑:程序博客网 时间:2024/06/06 13:18
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 (?3.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 (?5.6).
原创粉丝点击