PART I
C h a p t e r 1 5 :
D e l e g a t e s , E v e n t s , a n d L a m b d a E x p r e s s i o n s
425
PART IPART I
event
event-delegate event-name
{
add {
// code to add an event to the chain
}
remove {
// code to remove an event from the chain
}
}
This form includes the two event accessors
add
and
remove
. The
add
accessor is called
when an event handler is added to the event chain, by using
+=
. The
remove
accessor is
called when an event handler is removed from the chain, by using
– =
.
When
add
or
remove
is called, it receives the handler to add or remove as a parameter.
As with other types of accessors, this parameter is called
Do'stlaringiz bilan baham: |