CommunicationObject.Close CommunicationObject.Close CommunicationObject.Close CommunicationObject.Close Method

定義

通信オブジェクトを、現在の状態から Closed 状態に遷移させます。Causes a communication object to transition from its current state into the closed state.

オーバーロード

Close() Close() Close() Close()

通信オブジェクトを、現在の状態から Closed 状態に遷移させます。Causes a communication object to transition from its current state into the closed state.

Close(TimeSpan) Close(TimeSpan) Close(TimeSpan) Close(TimeSpan)

指定した時間内で、通信オブジェクトを現在の状態から Closed 状態に遷移させます。Causes a communication object to transition from its current state into the closed state within a specified interval of time.

Close() Close() Close() Close()

通信オブジェクトを、現在の状態から Closed 状態に遷移させます。Causes a communication object to transition from its current state into the closed state.

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

実装

例外

通信オブジェクトは、Opened 状態または Opening 状態ではなく、変更できません。The communication object is not in a Opened or Opening state and cannot be modified.

通信オブジェクトは、Closing 状態または Closed 状態であり、変更できません。The communication object is in a Closing or Closed state and cannot be modified.

通信オブジェクトは、Faulted 状態であり、変更できません。The communication object is in a Faulted state and cannot be modified.

操作に割り当てられている既定の時間が、操作が完了する前に経過しました。The default interval of time that was allotted for the operation was exceeded before the operation was completed.

注釈

このメソッドは、CommunicationObjectClosed 以外の状態から Closed 状態に正常に移行します。This method causes a CommunicationObject to gracefully transition from any state, other than the Closed state, into the Closed state. Close メソッドにより、戻る前に未完了の作業を完了できます。The Close method allows any unfinished work to be completed before returning. たとえば、バッファー内のメッセージの送信を完了します。For example, finish sending any buffered messages.

CommunicationObjectClosing 状態になり、その状態は、Close メソッドが呼び出された後、Closed 状態への遷移が完了するまで維持されます。The CommunicationObject enters the Closing state and remains in it after the Close method is called until the transition to the Closed state is completed. 遷移は、OnClosingOnClose(TimeSpan)、および OnClosed の連続した呼び出しで構成されます。The transition consists of making successive calls to OnClosing, OnClose(TimeSpan), and OnClosed.

BeginClose 呼び出しで開始される非同期バージョンの close メソッドもあります。There is also an asynchronous version of the close method that is initiated by calling BeginClose.

Close(TimeSpan) Close(TimeSpan) Close(TimeSpan) Close(TimeSpan)

指定した時間内で、通信オブジェクトを現在の状態から Closed 状態に遷移させます。Causes a communication object to transition from its current state into the closed state within a specified interval of time.

public:
 virtual void Close(TimeSpan timeout);
public void Close (TimeSpan timeout);
abstract member Close : TimeSpan -> unit
override this.Close : TimeSpan -> unit
Public Sub Close (timeout As TimeSpan)

パラメーター

timeout
TimeSpan TimeSpan TimeSpan TimeSpan

クローズ操作がタイムアウトになるまでの時間を表す TimeSpanThe TimeSpan that specifies how long the close operation has to complete before timing out.

実装

例外

通信オブジェクトは、Opened 状態または Opening 状態ではなく、変更できません。The communication object is not in a Opened or Opening state and cannot be modified.

通信オブジェクトは、Closing 状態または Closed 状態であり、変更できません。The communication object is in a Closing or Closed state and cannot be modified.

通信オブジェクトは、Faulted 状態であり、変更できません。The communication object is in a Faulted state and cannot be modified.

操作に割り当てられている既定の時間が、操作が完了する前に経過しました。The default interval of time that was allotted for the operation was exceeded before the operation was completed.

注釈

このメソッドは、CommunicationObject を、Closed 状態以外の任意の状態から Closed 状態に、指定した時間内で正常に遷移させます。This method causes a CommunicationObject to gracefully transition from any state, other than the Closed state, into the Closed state within a specified interval of time. Close メソッドにより、戻る前に未完了の作業を完了できます。The Close method allows any unfinished work to be completed before returning. たとえば、バッファー内のメッセージの送信を完了します。For example, finish sending any buffered messages.

CommunicationObjectClosing 状態になり、その状態は、Close メソッドが呼び出された後、Closed 状態への遷移が完了するまで維持されます。The CommunicationObject enters the Closing state and remains in it after the Close method is called until the transition to the Closed state is completed. 遷移は、OnClosingOnClose(TimeSpan)、および OnClosed の連続した呼び出しで構成されます。The transition consists of making successive calls to OnClosing, OnClose(TimeSpan) and OnClosed.

BeginClose 呼び出しで開始される非同期バージョンの close メソッドもあります。There is also an asynchronous version of the close method that is initiated by calling BeginClose.

適用対象