BackgroundWorker的和线程之间的区别? [英] Difference between BackgroundWorker and Thread?

查看:817
本文介绍了BackgroundWorker的和线程之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的BackgroundWorker 之间的区别是什么?在我的应用程序正在使用的邮件系统与数据库定期进行通信。哪一个我想在这里使用:<?code>的BackgroundWorker 或

What is the difference between BackgroundWorker and Thread? In my application I am using a messaging system that communicates with the database regularly. Which one would I want to use here: BackgroundWorker or Thread?

推荐答案

A <一个href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx">BackgroundWorker是准备使用类的WinForms允许执行上避免冻结UI后台线程并且除了任务,这可以让你轻松当元帅的主线程,让你更新用户的可能性就成功回调的执行接口的结果。这也给来跟踪进度和取消任务的可能性。它使用线程的线程池。

A BackgroundWorker is a ready to use class in WinForms allowing you to execute tasks on background threads which avoids freezing the UI and in addition to this allows you to easily marshal the execution of the success callback on the main thread which gives you the possibility to update the user interface with the results. It also gives the possibility to track progress and cancel the task. It uses threads from the thread pool.

另外一个线程是一个类,可以方便地在新的线程执行一些任务。这是一个更基本的概念。

On the other hand a Thread is a class allowing you to simply execute some task on a new thread. It's a much more basic concept.

这篇关于BackgroundWorker的和线程之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆