Create or identify a delegate
If you are defining your own event, you must also ensure that there is a delegate to use with the event keyword
Create a class that contains:
1. An event created from the delegate
2. Optional. A method that verifies that an instance of the delegate declared with the event keyword exists
3. Method that calls the event
Define one or more classes that connect methods to the event. These classes will include:
a. Associate one or more methods using the += and -= operators, with the event base class
b. The definition of the method(s) that will be associated with the event
Use the event
a. Create an object of the class that contains the event declaration
b. Create an object of the class that contains the event definition, using the constructor that was defined
No comments:
Post a Comment