public void TestObserver()
        {
            Patterns.Observer.Observable subject = new Patterns.Observer.Observable("Subject 1");
            Patterns.Observer.Observer   ob1     = new Observer.Observer(subject);
            Patterns.Observer.Observer   ob2     = new Observer.Observer(subject);

            subject.Value = 5;

            ob1.Dispose();
            ob2.Dispose();
        }
Beispiel #2
0
        public static void UseObserver()
        {
            var observable = new Observable();

            var firstObserver = new Patterns.Observer.Observer();
            observable.Subscribe(firstObserver);

            var secondObserver = new Patterns.Observer.Observer();
            observable.Subscribe(secondObserver);

            observable.NotifySubscribers();

            observable.NotifySubscribers();
        }