August 2013
Beginner
540 pages
12h 51m
English
After completing this chapter, you will be able to:
Understand what delegates are.
Create and use delegates.
Explain what events are.
Create and use events.
Delegates and events are extremely powerful and important constructs in the Microsoft .NET Framework. Events in particular are used widely in GUI applications as a means of communicating between components, but both delegates and events can be used to good effect in non-GUI code.
The function pointer mechanism in C and C++ has been used by programmers for many years, and it’s a very useful way of implementing mechanisms such as event handlers. Unfortunately, function pointers are a C++ language feature, so they’re of no use in the .NET environment, ...