Control.EndInvoke(IAsyncResult) Control.EndInvoke(IAsyncResult) Control.EndInvoke(IAsyncResult) Control.EndInvoke(IAsyncResult) Method

定义

检索由传递的 IAsyncResult 表示的异步操作的返回值。Retrieves the return value of the asynchronous operation represented by the IAsyncResult passed.

public:
 virtual System::Object ^ EndInvoke(IAsyncResult ^ asyncResult);
public object EndInvoke (IAsyncResult asyncResult);
abstract member EndInvoke : IAsyncResult -> obj
override this.EndInvoke : IAsyncResult -> obj
Public Function EndInvoke (asyncResult As IAsyncResult) As Object

参数

asyncResult
IAsyncResult IAsyncResult IAsyncResult IAsyncResult

IAsyncResult,表示特定的调用异步操作,在调用 BeginInvoke(Delegate) 时返回。The IAsyncResult that represents a specific invoke asynchronous operation, returned when calling BeginInvoke(Delegate).

返回

由异步操作生成的 ObjectThe Object generated by the asynchronous operation.

实现

异常

asyncResult参数值是nullThe asyncResult parameter value is null.

asyncResult对象不通过调用创建BeginInvoke(Delegate)从相同的控件的方法。The asyncResult object was not created by a preceding call of the BeginInvoke(Delegate) method from the same control.

注解

如果尚未完成异步操作,直到结果可用,将阻止此函数。If the asynchronous operation has not been completed, this function will block until the result is available.

备注

除了InvokeRequired属性,在控件上都是线程安全的四种方法: InvokeBeginInvokeEndInvoke,和CreateGraphics如果已创建控件的句柄。In addition to the InvokeRequired property, there are four methods on a control that are thread safe: Invoke, BeginInvoke, EndInvoke, and CreateGraphics if the handle for the control has already been created. 调用CreateGraphics后台线程上创建控件的句柄之前可能会导致非法的跨线程调用。Calling CreateGraphics before the control's handle has been created on a background thread can cause illegal cross thread calls. 对于所有其他方法调用,您应使用 invoke 方法之一来封送对控件的线程的调用。For all other method calls, you should use one of the invoke methods to marshal the call to the control's thread.

适用于

另请参阅