O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required