Summary

In this chapter, we discussed delegates and events. A delegate is an object that encapsulates some anonymous method by itself. To use a delegate, you should declare it, instantiate it with some method that should be associated with delegate, and then invoke it.

We also discussed what multicast and singlecast delegates are, their internal structure, and the common rules of their use. Multicast delegates are lists of linked delegates that are invoked by turn.

An event is a way for a class to provide notifications to clients of that class when some interesting thing happens to an object. We discussed the step-by-step process of creating and using events. The process comprises the following steps:

  • Delegate declaration
  • Event declaration
  • Declaration ...

Get Microsoft® Visual C#® .NET 2003 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.