Beispiel #1
0
 public void Exam(ExamEventArgs task)
 {
     if (examEvent != null)
     {
         examEvent(this, task);
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            List <Student> group = new List <Student> {
                new Student {
                    FirstName = "John",
                    LastName  = "Miller",
                    BirthDate = new DateTime(1997, 3, 12)
                },
                new Student {
                    FirstName = "Candice",
                    LastName  = "Leman",
                    BirthDate = new DateTime(1998, 7, 22)
                },
                new Student {
                    FirstName = "Joey",
                    LastName  = "Finch",
                    BirthDate = new DateTime(1996, 11, 30)
                },
                new Student {
                    FirstName = "Nicole",
                    LastName  = "Taylor",
                    BirthDate = new DateTime(1996, 5, 10)
                }
            };

            Teacher teacher = new Teacher();

            foreach (Student item in group)
            {
                teacher.examEvent += item.Exam;
            }

            ExamEventArgs eventArgs = new ExamEventArgs {
                Task = "Задача"
            };

            teacher.Exam(eventArgs);
        }
Beispiel #3
0
 public void Exam(object sender, ExamEventArgs e)
 {
     WriteLine($"Студент {LastName} решил {e.Task}");
 }