ClientBase<TChannel>.InvokeAsync(ClientBase<TChannel>.BeginOperationDelegate, Object[], ClientBase<TChannel>.EndOperationDelegate, SendOrPostCallback, Object) 方法

定義

提供實作事件架構非同步模式的支援。Provides support for implementing the event-based asynchronous pattern. 如需此模式的詳細資訊,請參閱事件架構非同步模式概觀For more information about this pattern, see Event-based Asynchronous Pattern Overview.

protected:
 void InvokeAsync(System::ServiceModel::ClientBase<TChannel>::BeginOperationDelegate ^ beginOperationDelegate, cli::array <System::Object ^> ^ inValues, System::ServiceModel::ClientBase<TChannel>::EndOperationDelegate ^ endOperationDelegate, System::Threading::SendOrPostCallback ^ operationCompletedCallback, System::Object ^ userState);
protected void InvokeAsync (System.ServiceModel.ClientBase<TChannel>.BeginOperationDelegate beginOperationDelegate, object[] inValues, System.ServiceModel.ClientBase<TChannel>.EndOperationDelegate endOperationDelegate, System.Threading.SendOrPostCallback operationCompletedCallback, object userState);
member this.InvokeAsync : System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>.BeginOperationDelegate * obj[] * System.ServiceModel.ClientBase<'Channel (requires 'Channel : null)>.EndOperationDelegate * System.Threading.SendOrPostCallback * obj -> unit
Protected Sub InvokeAsync (beginOperationDelegate As ClientBase(Of TChannel).BeginOperationDelegate, inValues As Object(), endOperationDelegate As ClientBase(Of TChannel).EndOperationDelegate, operationCompletedCallback As SendOrPostCallback, userState As Object)

參數

beginOperationDelegate
ClientBase<TChannel>.BeginOperationDelegate

用來呼叫非同步作業的委派。A delegate that is used for calling the asynchronous operation.

inValues
Object[]

非同步呼叫的輸入值。The input values to the asynchronous call.

endOperationDelegate
ClientBase<TChannel>.EndOperationDelegate

完成後用來結束非同步呼叫的委派。A delegate that is used to end the asynchronous call after it has completed.

operationCompletedCallback
SendOrPostCallback

完成非同步方法之後叫用的回呼 (由用戶端供應)。A client-supplied callback that is invoked when the asynchronous method is complete. 回呼會傳遞至 ClientBase<TChannel>.BeginOperationDelegateThe callback is passed to the ClientBase<TChannel>.BeginOperationDelegate.

userState
Object

要與非同步呼叫產生關聯的 userState 物件。The userState object to associate with the asynchronous call.

備註

每次呼叫 userState 時,可以在 InvokeAsync(ClientBase<TChannel>.BeginOperationDelegate, Object[], ClientBase<TChannel>.EndOperationDelegate, SendOrPostCallback, Object) 參數中提供 GUID 或雜湊程式碼等唯一值,當每個作業完成時,事件處理常式就可以判斷哪一個作業執行個體引發了完成事件。Provide a unique value, such as a GUID or hash code, in the userState parameter for each call to InvokeAsync(ClientBase<TChannel>.BeginOperationDelegate, Object[], ClientBase<TChannel>.EndOperationDelegate, SendOrPostCallback, Object), and when each operation is completed, your event handler can determine which instance of the operation raised the completion event.

適用於