Event Extension Methods

The following extension methods are defined for event related types. They save you from the burden to first test whether the eventhandler is null before raising the event. All RaiseEvent methods are no-ops if the event handler specified is null.

EventHandler specific

  • void RaiseEvent(object sender).
    Raises the event which is represented  by the event handler specified with default, empty arguments, if the event handler specified isn't null.

EventHandler<T> specific

  • void RaiseEvent<T>(object sender, T arguments).
    Raises the event which is represented  by the event handler specified with the arguments specified, if the event handler specified isn't null.

PropertyChangedHandler specific

  • void RaiseEvent(object sender, string propertyName).
    Raises the PropertyChanged event which is represented by the event handler specified for the property with the name specified in propertyName, if the event handler specified isn't null.

Last edited Nov 27, 2010 at 1:30 PM by SolutionsDesign, version 3

Comments

No comments yet.