public void ProcessExit_Add_Remove() { EventHandler handler = (sender, e) => { }; AppDomain.CurrentDomain.ProcessExit += handler; AppDomain.CurrentDomain.ProcessExit -= handler; }