CommunicationObject.ThrowIfDisposedOrImmutable 方法


如果通訊物件的 State 屬性並未設定為 Created 狀態,就會擲回例外狀況。Throws an exception if the communication object the State property is not set to the Created state.

protected public:
 void ThrowIfDisposedOrImmutable();
 void ThrowIfDisposedOrImmutable();
protected internal void ThrowIfDisposedOrImmutable ();
protected void ThrowIfDisposedOrImmutable ();
member this.ThrowIfDisposedOrImmutable : unit -> unit
Protected Friend Sub ThrowIfDisposedOrImmutable ()
Protected Sub ThrowIfDisposedOrImmutable ()


通訊物件處於 OpeningOpened 狀態中。The communication object is in a Opening or Opened state.

通訊物件處於 ClosingClosed 狀態中。The communication object is in a Closing or Closed state.

通訊物件處於 Faulted 狀態中。The communication object is in a Faulted state.


因為針對物件呼叫 Open 後,物件就無法變更,所以同時為可變動與未處置的唯一狀態是 Created 狀態。Since an object is immutable after Open is called on it, the only state that is both mutable and not disposed is the Created state.