Parameter.Clone Methode

Definition

Gibt ein Duplikat der aktuellen Parameter-Instanz zurück.

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

Gibt zurück

Parameter

Eine Parameter-Instanz, die ein exaktes Duplikat der aktuellen Instanz ist.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie der Parameter(Parameter) Konstruktor aus einer Klasse aufgerufen wird, die die Parameter Klasse erweitert, um das richtige Objektkloningverhalten für die Klasse zu implementieren. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die Parameter Klasse bereitgestellt wird.

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

Hinweise

Die Clone Methode ruft den Parameter(Parameter) Kopierkonstruktor auf, um eine neue Instanz der Parameter Klasse mit den Werten der aktuellen Instanz zu initialisieren.

Wenn Sie die Klasse erweitern, können Sie die Parameter Methode außer Kraft setzen, um einen beliebigen Zustand einzuschließen, der Clone in eine neue Instanz Ihrer abgeleiteten Klasse kopiert werden soll.

Gilt für

Siehe auch