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
(§14.5.7) in the accessors of that event.
When an event is referenced in a member-access (§14.5.4) of the form E.M,
if M is a static event, E must denote a
type, and if M is an instance event, E must denote an instance.
The differences between static and instance members are discussed further
in §17.2.5.
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
(§14.5.7) in the accessors of that event.
When an event is referenced in a member-access (§14.5.4) of the form E.M,
if M is a static event, E must denote a
type, and if M is an instance event, E must denote an instance.
The differences between static and instance members are discussed further
in §17.2.5.
本文详细解释了在编程中静态事件与实例事件的区别。静态事件与特定实例无关,而实例事件则与类的具体实例相关联。此外,文章还讨论了如何在不同上下文中引用这些事件。
697

被折叠的 条评论
为什么被折叠?



