Parameter.Clone Méthode

Définition

Retourne un doublon de l'instance de Parameter actuelle.

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

Retours

Parameter

Parameter qui est un doublon exact de l'objet actuel.

Exemples

L’exemple de code suivant montre comment appeler le Parameter(Parameter) constructeur à partir d’une classe qui étend la Parameter classe pour implémenter un comportement de clonage d’objet correct pour la classe. Cet exemple de code fait partie d’un exemple plus grand fourni pour la 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

Remarques

La Clone méthode appelle le Parameter(Parameter) constructeur de copie pour initialiser une nouvelle instance de la Parameter classe avec les valeurs de l’instance actuelle.

Si vous étendez la Parameter classe, vous pouvez remplacer la Clone méthode pour inclure tout état qui doit être copié dans une nouvelle instance de votre classe dérivée.

S’applique à

Voir aussi