Proper way to Dispose of a BackGroundWorker

后端 未结 5 1747
既然无缘
既然无缘 2020-11-28 11:44

Would this be a proper way to dispose of a BackGroundWorker? I\'m not sure if it is necesary to remove the events before calling .Dispose(). Also is calling .Dispose() ins

5条回答
  •  孤独总比滥情好
    2020-11-28 12:06

    Yes, this appears proper. Of course, disposable objects are better handled with using blocks, but you don't have that option here.

    I usually create my background handers with form lifetimes, reuse them, and let the designer code handle disposal on form close. Less to think about.

提交回复
热议问题