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属性外,控件上有四种线程安全方法: InvokeBeginInvokeEndInvokeCreateGraphics (如果已创建控件的句柄)。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. 对于所有其他方法调用,应使用调用方法之一封送对控件线程的调用。For all other method calls, you should use one of the invoke methods to marshal the call to the control's thread.

适用于

另请参阅