Exemple #1
0
        public void Run()
        {
            var subject = new ConcreteSubject();
            subject.Attach(new ConcreteObserver("Observer 1", subject));
            subject.Attach(new ConcreteObserver("Observer 2", subject));
            subject.Attach(new ConcreteObserver("Observer 3", subject));

            subject.State = "Hello World";
            subject.State = "abc";
        }
Exemple #2
0
 public ConcreteObserver(string name, ConcreteSubject subject)
 {
     Name = name;
     _subject = subject;
 }