Difference between BackgroundWorker and Thread?

前端 未结 7 1636
南旧
南旧 2020-12-07 00:58

What is the difference between BackgroundWorker and Thread? In my application I am using a messaging system that communicates with the database reg

7条回答
  •  执念已碎
    2020-12-07 01:40

    BackgroundWorker has already implemented functionality of reporting progress, completion and cancellation - so you don't need to implement it by yourself. Usage of Thread gives you more control over the async process execution (e.g. thread priority or choosing beetween foreground/background thread type).

    BTW sometimes you don't need progress reporting and other BackgroundWorker stuff - so Thread/ThreadPool will be good alternative.

提交回复
热议问题