// the method that implements the // delegated functionality public void TimeHasChanged(object Clock, TimeInfoEventArgs ti) { Console.WriteLine($"Class DisplayClock.TimeHasChanged:" + $" Current Time: {ti.Hour}:{ti.Minute}:{ti.Second}"); }
// this method should write to a file // we write to the console to see the effect // this object keeps no state public void WriteLogEntry(object theClock, TimeInfoEventArgs ti) { Console.WriteLine("Class LogCurrentTime.WriteLogEntry:" + $" Logging to file: {ti.Hour}:{ti.Minute}:{ti.Second}"); }