private void Going(object sender, ExamEventArgs e) { try { Inscribe(this); } catch (Exception ex) { throw new Exception("I really would take the examination, but unfortunately I will not be able.", ex.InnerException); } }
protected virtual void OnAnnounce(ExamEventArgs currentExam) { EventHandler<ExamEventArgs> handler = CustomExam; try { if (handler != null) { handler(this, currentExam); } Console.WriteLine("The exam on {0} is going to be on {1:dd.MM.yyyy, HH:mm} in {2}.", currentExam.Subject, currentExam.Date, currentExam.Place); } catch (Exception e) { throw new Exception("The examination will not take place due to unforeseen circumstances.", e.InnerException); } }