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. 所有其他的方法呼叫中,您應該使用其中一種叫用方法來對控制項的執行緒的呼叫封送處理。For all other method calls, you should use one of the invoke methods to marshal the call to the control's thread.

適用於

另請參閱