Export (0) Print
Expand All
2 out of 2 rated this helpful - Rate this topic

10.7.3 Static and instance events

Visual Studio .NET 2003

When an event declaration includes a static modifier, the event is said to be a static event. When no static modifier is present, the event is said to be an instance event.

A static event is not associated with a specific instance, and it is a compile-time error to refer to this in the accessors of a static event.

An instance event is associated with a given instance of a class, and this instance can be accessed as this (Section 7.5.7) in the accessors of that event.

When an event is referenced in a member-access (Section 7.5.4) of the form E.M, if M is a static event, E must denote a type containing M, and if M is an instance event, E must denote an instance of a type containing M.

The differences between static and instance members are discussed further in Section 10.2.5.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.