reusing the backgroundworker more than once

前端 未结 1 1957
伪装坚强ぢ
伪装坚强ぢ 2021-01-05 16:56

i am using the background worker to do an expensive operation:

backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
backgroundWorker         


        
相关标签:
1条回答
  • 2021-01-05 17:14

    Yes, you can re-use a BackgroundWorker - but you can only use it once at any time - not concurrently. If the operations are different, however, I'd use a separate worker. Otherwise you'll have to unhook the events, hook the correct events, etc. Messy.

    0 讨论(0)
提交回复
热议问题