public static void Main() { try { var theClassWithDelegate = new ClassWithDelegate(); var fs = new FirstSubscriber(); fs.Subscribe(theClassWithDelegate); var ss = new SecondSubscriber(); ss.SubScribe(theClassWithDelegate); theClassWithDelegate.Run(); } catch (Exception e) { Console.WriteLine("Exception : " + e); } }
public void SubScribe(ClassWithDelegate theClassWithDelegate) { theClassWithDelegate.TheDelegate += Doubler; }
public void Subscribe(ClassWithDelegate theClassWithDelegate) { theClassWithDelegate.TheDelegate += DisplayCounter; }