Http://blog.joyercode.com/percyboy/archive/2005/01/22/43438.aspx
.NET event model tutorial (cover)
I haven't sent articles for a long time. Today, I have written a tutorial for more than half a month. It is limited to the space that cannot be released to the home page. The directory is as follows:
.NET event model tutorial (1)
Events, Event Handle Concepts Problem Description: A solution that requires a high-coupled implementation model for a longer period of time, easy-to-understand VB.NET version delegate (DELEGATE) Introduction C # Implementation ".NET Framework class library Design Guide "is close to, standard implementation
.NET event model tutorial (2)
Attribute style event declaration unicast event and multicast event support multicast event improvements
.NET event model tutorial (3)
Use interface to implement callback .NET event model and comparison of Java event models
Event, Event Processor Concept
In the object-oriented theory, an object (example) can have members with the attribute (the state of the Property, Get, or Setting the Object), the method (Method, the action of the object), etc., there is an event (Event). The so-called event is some changes in the internal state of the object, or when the object does some action (or before, after doing), the notification to the outside world. For a few more, the object "Zhang San" stomach hurts, then he stood on the air, "I have a hurt!" The event is this notice.
Then, the external environment may need to respond to the occurrence of certain events relative to the event notification within the object. Then, after the other side, Zhang San was called, the ambulance came to the hospital (or a madhouse, huh, huh, start a joke). The outside world is made in response to the event (specifically to the program, "the processing code written for this event), called an event handler.
The event handler must be linked to the object's event hook. Otherwise, the isolated event handler will not be executed. On the other hand, when an event occurs, it does not have to have a corresponding handler. Just after Zhang San's call, the external environment did not make any response. That is to say, there is no inevitable connection between the events of the object and the external events of the object, and you need you to hook.
Before starting learning, I hope that everyone first distinguishes two concepts of "events" and "event handlers". The event is belonging to the object (class) itself, and the event handler is the reaction made by the external code for an object of the object. The event is the designer of the object (class), and the developer should be completed; the event handler is the external caller needs to be done. Simply put, the event is "inward"; the event handler is "outside".
After learning the above basic concepts, we start learning the specific code implementation process. Because it involves a lot of code, it is limited to the space, I just put the more important part of the code in the article, analyze, the remaining code or the reader can check it yourself, I have put the source code to make download. I also suggest that you learn the tutorial in contrast to these source code. [Download the source code of this tutorial]
...... (more, more details, please click on the link in the directory) ...