How to dispose BackgroundWorkers the right way
- by radbyx
I've got a Windows Service that runs BackgroundWorker's, and I'm wondering if I'm doing the right thing when I stop my Windows Service.
Is it enough to:
Let the BackgroundWorker1_DoWork method complete (I have a while loop in it now, doing some tasks)
Set the variable that holds the reference to the BackgroundWorker, to null
Is there some kind of Dispose() method I need to call (In the same way the Timer class has Timer.Dispose();)?