Lecture overview -- Keyboard shortcut: 'u'  Previous page: Events -- Keyboard shortcut: 'p'  Next page: Examples of events -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 39 : 45
Object-oriented Programming in C#
Data Access and Operations
Events in C#

An event is a variable of a delegate type

A few restrictions apply compared with other variables of delegate types

Events can be used for handling interactive events in graphical user interfaces

  • Restrictions on events

    • An event can only be activated from within the class to which the event belongs

    • From outside the class it is only possible to add (with +=) or subtract (with -=) operations to an event.

      • It is not possible to 'reset' the event with an ordinary assignment

There exists a generic delegate EventHandler<TEVentArgs> which is intended to be used as the type of standard events in .NET