Best Answer JerseyTechGuy, 05 April 2013 - 07:32 PM
I've always felt it was a good practice to remove event handlers when not needed or simply just to flush out long lived event handlers. The nice thing about CW2s approach is these are GPIO port specific. If your port is called myPort then you are calling myPort.EnableInterrupt() or myPort.DisableInterrupt(). I am using this for the menu system on Pandora's Box controlled by a 5 way Tactile switch. I have interrupts for any button press (Up/down/left/right/enter) and during certain menu operations they may need to be enabled/disabled however when the box goes into scan mode (logging mode) I remove the handler all together instead of just disabling it as it could be running several hours or days in logging mode.
I believe when you explicitly remove the handler (-=) GC automatically happens so there are no remnants left behind.
Go to the full post