Skip to content

Commit

Permalink
Update docs/csharp/language-reference/keywords/event.md
Browse files Browse the repository at this point in the history
Just suggestions: An ***event*** is a member that enables notifications to be triggered. Clients can attach executable code for events by supplying ***event handlers***. The `event` keyword declares an ***event***. The event is of a delegate type. While triggering an event all supplied event handlers are invoked. Event handlers are delegate instances added to the event. Event users can add or remove their event handlers to/from an event.

Co-authored-by: Bill Wagner <[email protected]>
  • Loading branch information
mpostol and BillWagner committed Sep 20, 2024
1 parent b63ef19 commit 7082df0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions docs/csharp/language-reference/keywords/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ ms.assetid: 7858fd85-153b-4259-85d0-6aa13c35f174
---
# event (C# reference)

The `event` keyword changes the regular variable into an event variable. Referring to the language semantics the variable must be of a delegate type (it is a set of pointers to methods compliant with a predefined signature). The "event" keyword changes the visibility of selected operations we can execute against the event variable despite the access modifier of the variable. For example, we cannot invoke pointed methods outside the class where the event variable is declared even if the variable is public. Hence, this class is called publisher. All these operations are only private. In other words, the "event" keyword is an access modifier replacement for selected operations of the delegate type.

The level of abstraction means that we don't know the methods, we only know that all are compliant with the predefined signature. Consequently, signaling an event means that we are calling methods pointed by the set held by the event variable. The event variable may be used in the methods invocation statement and expressions like a regular method.
An ***event*** is a member that enables an object or class to provide notifications. Clients can attach executable code for events by supplying ***event handlers***. The `event` keyword declares an ***event***. An instance of an event is a delegate type. An object raises the event by invoking event handlers. Event handlers are delegate instances added to the event instance. Clients can add or remove their event handlers from an event.

## Example

Expand Down

0 comments on commit 7082df0

Please sign in to comment.