GC and static events RRS feed

  • Question

  • While looking at the SystemEvents class I came across a note that's attached to the various static events:

    "Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result."

    I'm confused about the wording of that sentence.  If my application is closing, do I really need to unsubscribe to these static events?  I fully understand why my objects would not be GC'd at runtime if I didn't unsubscribe to these events...but if my application is closing does it really matter at that point?  I assume that it doesn't but would like to be sure.  Maybe it should read "when your object is disposed"...


    Tuesday, June 1, 2010 7:02 AM


All replies