using System; namespace wildert { public class Metronome { public event TickHandler Tick; public EventArgs e = null; public delegate void TickHandler(Metronome m, EventArgs e); public void Start() { while (true) { System.Threading.Thread.Sleep(3000); if (Tick != null) { Tick(this, e); } } } } public class Listener { public void Subscribe(Metronome m) { m.Tick += new Metronome.TickHandler(HeardIt);//I am getting error here } private void HeardIt(Metronome m, EventArgs e) { System.Console.WriteLine("HEARD IT"); } } class Test { static void Main() { Metronome m = new Metronome(); Listener l = new Listener(); l.Subscribe(m); m.Start(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)