如何在后台线程上调用 [英] How to Invoke on background thread

查看:98
本文介绍了如何在后台线程上调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在后台线程上调用方法?

Is there a way to invoke a method on a background thread ?

我知道BackgroundWorker/正在创建线程或使用ThreadPool.QueueUserWorkItem等,但这不是我要寻找的答案

I am aware of BackgroundWorker/Creating a thread or use ThreadPool.QueueUserWorkItem etc but that's not the answer i am looking for

例如SCSF具有确保在后台或UI线程上调用该方法的属性

for e.g. the SCSF has attributes to ensure the method is invoked on a background or a UI thread

我想为一个小型应用做类似的事情,并且正在寻找一个可行的例子

I'd like to do something similar for a small app and am looking for a working example

推荐答案

我认为 BackgroundWorker 将满足您的需求.它允许您在Winform应用程序中在后台运行操作 .这些文章有工作示例. :)

I think the BackgroundWorker will fit your needs. It allows you to run an operation in the background in a Winform app. Those articles have working examples. :)

这篇关于如何在后台线程上调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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