So we know that if you attach an event handler, we should remove it at some point if the object is not being used anymore. How does this work for Window objects?
Take for example, the Window’s Loaded event, or Closing event. If we register the EventHandlers to handle these events in the Initialize method, why don’t we ever unregister them?
Because it is not a big deal. Usually you subscribe to the event in the derived class itself, so you will not cause the instance to linger in memory because of a stray event handler subscription. Also you will need the
Closingevent handler until the very end of the Window’s lifetime, there is no point in unsubscribing from it.