How to pass an event to a method and then subscribe to it?
- by Ryan Peschel
Event Handler
public void DeliverEvent(object sender, EventArgs e)
{
}
#1: This Works
public void StartListening(Button source)
{
source.Click += DeliverEvent;
}
#2: And so does this..
public void StartListening(EventHandler eventHandler)
{
eventHandler += DeliverEvent;
}
But in #2, you cannot call the method because if you try…