Пример #1
0
            public static void Main(string[] args)
            {
                Console.Write("请输入您要取款的金额:");
                string amount = Console.ReadLine();

                Console.WriteLine("交易成功,请取磁卡。");
                //初始化e
                UserEventArgs user = new UserEventArgs("*****@*****.**", "18868789776", amount);
                //初始化订阅系统
                SubscribSystem subject = new SubscribSystem(new BankAccount(), user);

                Console.ReadKey();
            }
Пример #2
0
        static void Main(string[] args)
        {
            Console.Write("请输入您要取款的金额:");
            string amount = Console.ReadLine();

            Console.WriteLine("交易成功,请取磁卡。");
            //初始化e
            UserEventArgs user = new UserEventArgs("*****@*****.**", "18868789776", amount);

            //初始化订阅系统
            SubscribSystem subject = new SubscribSystem(new BankAccount(), user);

            Console.ReadKey();
            //委托观察者模式总结
            //1.定义一个事件数据类,有事件要用到的数据 如这里的UserEventArgs 2.定义一个订阅系统 ,初始化时传入发布者和事件参数,实现发布者的事件
            //
        }