VB事件等效? [英] vb event equivalent?

查看:71
本文介绍了VB事件等效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在c#中构建线程化的应用程序(在vb中做了很多),但是我迷失在通知主线程子线程已完成的正确方法上.

I'm trying to build a threaded application in c# (have done many in vb) but I'm stumped on the proper way to notify the main thread that the child thread is finished.

在vb中,我将在子线程类中定义一个事件,并在完成时引发该事件.然后使用addhandler语句将其链接到主线程中的子链接.

In vb I'd define an event in the child thread class and raise it when completed. It would then be linked to a sub in the main thread using the addhandler statement to link it.

C#似乎无法以这种方式工作.有人可以启发我吗?我使用的是标准Thread类,而不是Tasks.

C# appears not to work this way. Could someone enlighten me on this? I'm using the standard Thread class and not Tasks.

谢谢

车辙

Mike Rutledge

Mike Rutledge

推荐答案

从此处

这篇关于VB事件等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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