Bewerken

Delen via


IExtension<T>.Detach(T) Method

Definition

Enables an object to find out when it is no longer aggregated. Called when an extension is removed from the Extensions property.

public:
 void Detach(T owner);
public void Detach (T owner);
abstract member Detach : 'T -> unit
Public Sub Detach (owner As T)

Parameters

owner
T

The extensible object that aggregates this extension.

Remarks

Use the Detach method to find out when the extension has been removed. An extension can use this to unhook events on the extensible object. An extension can also throw System.InvalidOperationException from this method to indicate that, once added, the extension cannot be removed.

Note that this method is not called when the owner object is disposed or closed. If needed, it is up to the extension or the code adding the extension to hook the appropriate System.ServiceModel.ICommunicationObject events or implement the appropriate interfaces (for System.ServiceModel.OperationContext) to observe the lifecycle of the owner.

Applies to