Events

This lesson will teach you about events in C# and how they're related with delegates!

An event is a special kind of delegate that facilitates event-driven programming.

Events are class members that cannot be called outside of the class regardless of its access specifier.

So, for example, an event declared to be public would allow other classes the use of += and -= on the event, but firing the event (i.e. invoking the delegate) is only allowed in the class containing the event.

A simple example:

Get hands-on with 1200+ tech skills courses.