Esempio n. 1
0
        static void Main(string[] args)
        {
            EvtPublisher ep = new EvtPublisher();

            EvtSubscriber es = new EvtSubscriber();

            ep.evt += es.HandleTheEvent;

            ep.CheckBalance(260);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            // Instantiate an event publisher object
            EvtPublisher ep = new EvtPublisher();

            // Instantiate an event subscriber object
            EvtSubscriber es = new EvtSubscriber();

            ep.evt += es.HandleTheEvent;

            // Call the CheckBalance method on the ep object
            // it will invoke the ep.evt delegate if the balance exceeds 250
            ep.CheckBalance(260);
        }
        static void Main(string[] args)
        {
            // Instantiate an event publisher object
            EvtPublisher ep = new EvtPublisher();

            // Instantiate an event subscriber object
            EvtSubscriber es = new EvtSubscriber();

            // Subscribe to the ep.evt event by making the es.HandleTheEvent method
            // a target of the ep.evt delegate
            ep.evt += es.HandleTheEvent;

            // Call the CheckBalance method on the ep object
            // it will invoke the ep.evt delegate if the balance is over 250
            ep.CheckBalance(251);
        }