Summary


This has been a tough chapter, as you will have seen some new concepts and ways of programming. Still, a good understanding of how events work in the .NET Framework is essential for building even simple Windows Forms applications and ASP.NET Web Forms applications (commonly known as websites).

We've seen how to use delegates in general programming tasks, such as specifying which method to invoke but delaying its execution until we are ready or even having a task performed on a separate thread. Also, delegates can be used with or without the event mechanism.

Events in the .NET Framework make use of multicast delegates. We can define delegate types to specify the method signatures for our event-handler methods. The event mechanism implicitly creates delegate objects, and uses these delegate objects to keep track of the event handlers for each event.

We've seen many examples in this chapter, to illustrate recommended best practices for events and delegates in C#. We've also spent some time looking at MSIL code, to see how events and delegates work internally. This will help you decide how to use events and delegates effectively in your own applications.




C# Class Design Handbook(c) Coding Effective Classes
C# Class Design Handbook: Coding Effective Classes
ISBN: 1590592573
EAN: 2147483647
Year: N/A
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net