Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 public void SubScribe(ClassWithDelegate theClassWithDelegate)
 {
     theClassWithDelegate.TheDelegate +=
         Doubler;
 }
Beispiel #3
0
 public void Subscribe(ClassWithDelegate theClassWithDelegate)
 {
     theClassWithDelegate.TheDelegate +=
         DisplayCounter;
 }