Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ISubject sub = new Subject();
            ObserverA observerA = new ObserverA(sub);
            ObserverB observerB = new ObserverB(sub);
            sub.UpdateEvent += observerA.UpdateA;
            sub.UpdateEvent += observerB.UpdateB;

            sub.State = "Hello";
            sub.Notify();
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ISubject  sub       = new Subject();
            ObserverA observerA = new ObserverA(sub);
            ObserverB observerB = new ObserverB(sub);

            sub.UpdateEvent += observerA.UpdateA;
            sub.UpdateEvent += observerB.UpdateB;

            sub.State = "Hello";
            sub.Notify();
            Console.ReadLine();
        }