Parameter.Clone Método

Definição

Devolve um duplicado da instância atual Parameter .

protected:
 virtual System::Web::UI::WebControls::Parameter ^ Clone();
protected virtual System.Web.UI.WebControls.Parameter Clone();
abstract member Clone : unit -> System.Web.UI.WebControls.Parameter
override this.Clone : unit -> System.Web.UI.WebControls.Parameter
Protected Overridable Function Clone () As Parameter

Devoluções

A Parameter que é uma cópia exata da atual.

Exemplos

O exemplo de código seguinte demonstra como chamar o Parameter(Parameter) construtor a partir de uma classe que estende a Parameter classe para implementar o comportamento correto de clonagem de objetos para a classe. Este exemplo de código faz parte de um exemplo maior fornecido para a Parameter classe.

// The StaticParameter copy constructor is provided to ensure that
// the state contained in the DataValue property is copied to new
// instances of the class.
protected StaticParameter(StaticParameter original) : base(original) {
  DataValue = original.DataValue;
}

// The Clone method is overridden to call the
// StaticParameter copy constructor, so that the data in
// the DataValue property is correctly transferred to the
// new instance of the StaticParameter.
protected override Parameter Clone() {
  return new StaticParameter(this);
}
' The StaticParameter copy constructor is provided to ensure that
' the state contained in the DataValue property is copied to new
' instances of the class.
Protected Sub New(original As StaticParameter)
   MyBase.New(original)
   DataValue = original.DataValue
End Sub

' The Clone method is overridden to call the
' StaticParameter copy constructor, so that the data in
' the DataValue property is correctly transferred to the
' new instance of the StaticParameter.
Protected Overrides Function Clone() As Parameter
   Return New StaticParameter(Me)
End Function

Observações

O Clone método chama o Parameter(Parameter) copy constructor para inicializar uma nova instância da Parameter classe com os valores da instância atual.

Se estenderes a Parameter classe, podes sobrescrever o Clone método para incluir qualquer estado que deva ser copiado para uma nova instância da tua classe derivada.

Aplica-se a

Ver também