How Events Work
Approaching events from a C# language angle, there’s not much to them. Events are declared as members of a class or a struct, with the common set of available modifiers such as the static keyword and the visibility modifiers. From a typing perspective, an event must be declared with a delegate type. For example:
public event Action Finished;
As you will see, it’s a common recommended practice to use certain delegate types for events to create a common experience across the board. For now, we’ll ignore this and focus on the inner workings of events for a minute or two.
What do events consist of on the inside? Let’s make some informed guesses before taking a closer look with ILDASM. First, events are a different sort of member ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access