Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Global Event Distributor

0.00/5 (No votes)
18 Dec 2007 1  
Global event handler 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.

Using the Code

Publish your event:

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

Subscribe to the event:

This must be public!

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

History

  • 18th December, 2007: Initial post

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here