Parameter.Clone Método

Definición

Devuelve un duplicado de la instancia Parameter actual.

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

Devoluciones

Parameter

Parameter que es un duplicado exacto del actual.

Ejemplos

En el ejemplo de código siguiente se muestra cómo llamar al Parameter(Parameter) constructor desde una clase que extiende la Parameter clase para implementar el comportamiento correcto de clonación de objetos para la clase . Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la Parameter clase .

// 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

Comentarios

El Clone método llama al Parameter(Parameter) constructor de copia para inicializar una nueva instancia de la Parameter clase con los valores de la instancia actual.

Si extiende la Parameter clase, puede invalidar el Clone método para incluir cualquier estado que se debe copiar en una nueva instancia de la clase derivada.

Se aplica a

Consulte también