Ispirer Ispirer
 


Ispirer Home Page Ispirer SQLWays Product Page - Migration to .NET Request SQLWays

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.


Ispirer Home Page Ispirer SQLWays Product Page - Migration to .NET Request SQLWays

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