Esempio n. 1
0
        // Que Write classes for events, one class which exposes an event and another which handles the event.
        //1)    Create a class to pass as an argument for the event handlers
        //2)    Set up the delegate for the event
        //3)    Declare the code for the event
        //4)    Create code the will be run when the event occurs
        //5)    Associate the event with the event handler

        static void Main(string[] args)
        {
            var person = new Person();
            var notify = new Notification();

            notify.userevent += person.SendNotification;

            person.name = Console.ReadLine();
            person.Display();
            notify.Alarm();
        }