IExtension<T>.Attach Method (T)

 

Enables an extension object to find out when it has been aggregated. Called when the extension is added to the IExtensibleObject<T>.Extensions property.

Namespace:   System.ServiceModel
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

void Attach(
	T owner
)

Parameters

owner
Type: T

The extensible object that aggregates this extension.

Type Parameters

T

The type of the extensible object. T must implement IExtensibleObject<T>.

Use this method to keep track of the IExtensibleObject<T> object to which the current instance of the extension belongs. This call gives extensions a chance to handle events or inspect properties of their owner.

The following example code shows how this method can be used to keep track of the IExtensibleObject<T> object to which the current instance of the extension belongs.

[C#]

InstanceContext owner;

public void Attach(InstanceContext owner)
{
  this.owner = owner; 
}

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: