Background Worker Process or Thread?

前端 未结 5 2142
鱼传尺愫
鱼传尺愫 2021-01-07 05:45

I have a Winform app which lists a batch of invoices in a gridview. The users select the batch and clicks a button, \"Generate Invoices\". The process takes about 4-5 mins.

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-07 06:09

    This is the exact type of task for which BackgroundWorker is meant. You should just push this into a background worker, and allow it to run. This provides a simple way to update your progress bar, etc.

    There is no reason to make your own thread for this. The ThreadPool via BackgroundWorker will work perfectly well.

提交回复
热议问题