2016-05-04 3 views
0

IDisposable.Dispose()の方法の中に私のチャンネルのICommunicationObject.Close()メソッドを起動します。チャネルのCommunicationStateCommunicationState.OpeningにあるときにICommunicationObject.Close()に電話をかけることはできますか?チャネルの `CommunicationState`が` CommunicationState.Opening`にあるときに `ICommunicationObject.Close()`を呼び出すことは許可されていますか?

I.e.そのようなチェックは、ICommunicationObjectインスタンスを閉じるのに十分ですか?

ICommunicationObject commObj = channel as ICommunicationObject; 
if (null != commObj && 
    commObj.State == CommunicationState.Opened || 
    commObj.State == CommunicationState.Opening) { 

    commObj.Close(); 
} 

答えて

関連する問題