コード例 #1
0
        static void Main(string[] args)
        {
            MyEvent  evt      = new MyEvent();
            Deposit  deposit  = new Deposit();
            WithDraw withDraw = new WithDraw();

            evt.MyBalance += deposit.DepositHandler;
            int bal = 100;

            evt.RaiseEvent(ref bal);
            Console.WriteLine("Balance is" + bal);
            evt.MyBalance -= deposit.DepositHandler;
            evt.MyBalance += withDraw.WithDrawHandler;

            evt.RaiseEvent(ref bal);
            Console.WriteLine("Balance is" + bal);
            Console.ReadKey();
        }