Challenge 3: A Safely-Guarded Alarm Event — Possible Solution ==================================================================== Alarm.cs: class Alarm { public event Action Triggered; public void Sound() { Triggered?.Invoke(); // safe even if nobody has subscribed } } Program.cs: var alarm1 = new Alarm(); alarm1.Sound(); // no subscriber attached -- should NOT throw var alarm2 = new Alarm(); alarm2.Triggered += () => Console.WriteLine("Alarm triggered!"); alarm2.Sound(); // subscriber attached -- runs it Console.WriteLine("Both calls completed without throwing."); Output: Alarm triggered! Both calls completed without throwing. Explanation: alarm1.Sound() calls Triggered?.Invoke() while Triggered is still null (nobody has subscribed yet). The ?. operator short-circuits the call entirely instead of invoking a null delegate, so nothing happens and no exception is thrown. alarm2 has a real subscriber attached via +=, so Triggered is no longer null, and Triggered?.Invoke() runs it normally, printing the message. Without the ?. guard, alarm1.Sound() would have thrown NullReferenceException instead. WHY THIS WORKS AS AN ANSWER ------------------------------ This demonstrates the exact null-event gotcha the chapter's warn-box describes, using ?.Invoke() to safely handle both the no-subscriber and has-subscriber cases without ever throwing.