Example #1
0
        static void Main(string[] args)
        {
            NBAObserver tongshi1 = new NBAObserver("金城武");
            NBAObserver tongshi2 = new NBAObserver("黄晓明");

            Secretary secretary = new Secretary();

            tongshi1.Subscribe(secretary, NBAStop1);
            tongshi2.Subscribe(secretary, NBAStop2);
            secretary.SubjectState = "老板来了";

            secretary.Notify();
            Console.ReadKey();
        }
 public void UnSubscribe(Secretary subject, EventHandler eventHandler)
 {
     subject.Update -= eventHandler;
 }