Summary
Delegates and events are crucial pieces that make the .NET Framework tick. Having a solid understanding of both concepts will take you a long way in discovering framework functionality and designing your own extensible APIs.
After covering delegates in the previous chapter, we moved on to explain events in terms of multicast delegates. The core idea of events is to provide a way to attach event handlers to an event source in a more secure way than just exposing a delegate. This ensures that an event can be raised only from the inside of the object on which it’s defined and also prevents clients from messing with the list of event handlers. Again, two parties appear, similar to the ones seen for delegates. On the one side, there’s the ...
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