Saturday, December 15, 2007

Global Event Distributor

Introduction
This articles discusses how to add event handlers by defining custom attributes on the event definitions and their handler methods.

Background
By using EventDistirbutor, you don't need to have references between the event and its handler method class.

Short example
Publish your event:

[PublishEvent("OnOver")]
public event EventHandler OnOver;

Subscribe to the event:

[SubscriberEvent("OnOver")]
public void OnOver(object sender, EventArgs e)
{
Console.WriteLine("OnOver From Class A");
}//method acccesor should be public

Project name: EventDistributor
Download

No comments: