コード例 #1
0
        public void CatchCold()
        {
            var args = new CatchColdEventArg();

            args.Symptoms = new[] { "Sweating", "Dry Cough", "Nausea" };

            GetsSick?.Invoke(this, args);
        }
コード例 #2
0
        private static void CallDoctor(object sender, CatchColdEventArg e)
        {
            var person = (Person)sender;

            Console.WriteLine("Calling Doctor...");
            Console.WriteLine($"{person.Name} has catched a cold and He/She Displays the following Symptoms" +
                              $"\n" + new string('=', 40));

            foreach (var symptom in e.Symptoms)
            {
                Console.WriteLine("{0}", symptom);
            }
        }