Ispirer Ispirer
 

This is an old revision of the document!



SQLWays Product Page - Migration to .NET Free Evaluation

C# - Delegates and Events

This chapter describes delegates and events in C#.

Difference between Delegates and Events

The key difference between delegates and events is that events can be invoked only from the classes that declared them. Other classes that have access to event variables can only add subscribers, they cannot raise the events.

Even derived classes from the class declaring the event cannot fire the event directly. But you can create a method in the base class that invokes an event, and call this method from derived classes, so the event can be raised indirectly.

At the same time, delegates can be invoked by whoever has access to them.


SQLWays Product Page - Migration to .NET Free Evaluation

sqlways/dotnet/csharp-delegates-events.1266067010.txt.gz · Last modified: May 07, 2018, 03:11:14 PM (external edit)
 
© 1999-2020, Ispirer Systems Ltd.
All Rights Reserved.  Privacy Statement