IExtension<T>.Attach(T) Método
Definição
Habilita um objeto de extensão a descobrir quando ele foi agregado.Enables an extension object to find out when it has been aggregated. Chamado quando a extensão é adicionada à propriedade Extensions.Called when the extension is added to the Extensions property.
public:
void Attach(T owner);
public void Attach (T owner);
abstract member Attach : 'T -> unit
Public Sub Attach (owner As T)
Parâmetros
- owner
- T
O objeto extensível que agrega essa extensão.The extensible object that aggregates this extension.
Exemplos
O código de exemplo a seguir mostra como esse método pode ser usado para controlar o IExtensibleObject<T> objeto ao qual a instância atual da extensão pertence.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.
InstanceContext owner;
public void Attach(InstanceContext owner)
{
this.owner = owner;
}
Comentários
Use esse método para controlar o IExtensibleObject<T> objeto ao qual a instância atual da extensão pertence.Use this method to keep track of the IExtensibleObject<T> object to which the current instance of the extension belongs. Essa chamada dá às extensões a oportunidade de lidar com eventos ou inspecionar Propriedades de seu proprietário.This call gives extensions a chance to handle events or inspect properties of their owner.