使用WaitHandle或EndInvoke有什么不同 [英] what different between using WaitHandle or EndInvoke

查看:71
本文介绍了使用WaitHandle或EndInvoke有什么不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用WaitHandle或EndInvoke在异步调用同步方法之间有什么不同

what different between using WaitHandle or EndInvoke in Calling Synchronous Methods Asynchronously

推荐答案

WaitHandle是您可以等待的东西。你可以使用它,如果你有东西并且想要阻塞它,直到它完成。

A WaitHandle is something you can wait on. You would use this if you had something and wanted to block until it was done.

如果你调用了BeginInvoke,则必须调用EndInvoke。没有另一个你不会打电话给你。 BeginInvoke启动异步过程。 EndInvoke是让你得到结果的原因。

EndInvoke has to be called if you've called BeginInvoke. You wouldn't call one without the other. BeginInvoke starts the async process. EndInvoke is what gets you the results back.

这两件事的用例有很大的不同,所以我不知道你能在哪里使用它们一。如果您调用了BeginInvoke,则使用EndInvoke。如果您从未调用过BeginInvoke,那么EndInvoke
不是一个选项。

The use case for these two things are dramatically different so there wouldn't be any case I can think of where you would be able to use either one. If you called BeginInvoke then EndInvoke is what you use. If you have never called BeginInvoke then EndInvoke isn't an option.

如果你想发布一些示例代码和关于你想要做什么的解释,那么我们可以提供更好的指导。

If you want to post some sample code and an explanation about what you're trying to do then perhaps we can provide better guidance.


这篇关于使用WaitHandle或EndInvoke有什么不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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