Code Providers – Create Event Trigger
The Create Event Trigger CodeRush code provider generates an event trigger for the specified event. An event trigger is a single method that is used to raise an event. Although it is not strictly necessary to create such a trigger, it is useful, as it makes maintenance of the code simpler.
Once the code provider is applied, you can select the target position where the event trigger should be declared. The event trigger will be named OnEventName (where EventName is the name of the original event) and will be ‘virtual’, so derived classes can override the functionality and alter the manner in which events are fired:
Note that the protected OnEventName method allows derived classes to override the event without attaching a delegate to it. A derived class must always call the OnEventName method of the base class to ensure that registered delegates receive the event.—– Products: CodeRush Pro Versions: 11.2 and up VS IDEs: 2008 and up Updated: Feb/16/2012 ID: C156