CommunicationObject.Abort 方法


導致通訊物件立即從目前的狀態轉換為關閉狀態。Causes a communication object to transition immediately from its current state into the closing state.

 virtual void Abort();
public void Abort ();
abstract member Abort : unit -> unit
override this.Abort : unit -> unit
Public Sub Abort ()



這個方法表示應該忽略任何未完成的工作,或在傳回前強制終止。This method indicates that any unfinished work should be ignored or ungracefully terminated before returning. 您可以使用 Abort 方法來取消任何未處理的作業,包括未處理的 Close 呼叫。The Abort method can be used to cancel any outstanding operations, including outstanding calls to Close.

若要將 CommunicationObject 從任何 Closed 以外的狀態順利轉換為 Closed 狀態,請呼叫 Close 或是其中一個非同步版本:BeginCloseTo gracefully transition a CommunicationObject from any state other than Closed into the Closed state, call Close or one of its asynchronous versions, BeginClose.