Skip to content

Instantly share code, notes, and snippets.

@hagbarddenstore
Created February 18, 2014 13:48
Show Gist options
  • Save hagbarddenstore/9071301 to your computer and use it in GitHub Desktop.
Save hagbarddenstore/9071301 to your computer and use it in GitHub Desktop.
void Main()
{
var testApplication = new TestApplication();
testApplication.SomeEvent += EventHandler;
testApplication.FireEvent();
}
void EventHandler(object sender, EventArgs e)
{
Console.WriteLine("Event fired!");
}
class TestApplication
{
public event EventHandler<MyEventArgs> SomeEvent;
public void FireEvent()
{
if (SomeEvent != null)
{
SomeEvent(this, new MyEventArgs());
}
}
}
class MyEventArgs : EventArgs
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment