예제 #1
0
        public void Run()
        {
            WordList wordList = new WordList();
            WordObserver wordObserver = new WordObserver();

            wordList.Attatch(wordObserver);
            {
                wordList.Messages.Add("Hello");
                wordList.NotifyAll();

                wordList.Messages.Add("Message");

                wordList.Messages.Add("Tester");
                foreach(IObserver ob in wordList.GetObservers())
                {
                    wordList.Notify(ob);
                }
            }
            wordList.Detach(wordObserver);
        }
예제 #2
0
        public void Run()
        {
            WordList     wordList     = new WordList();
            WordObserver wordObserver = new WordObserver();

            wordList.Attatch(wordObserver);
            {
                wordList.Messages.Add("Hello");
                wordList.NotifyAll();

                wordList.Messages.Add("Message");


                wordList.Messages.Add("Tester");
                foreach (IObserver ob in wordList.GetObservers())
                {
                    wordList.Notify(ob);
                }
            }
            wordList.Detach(wordObserver);
        }