Parameter.Clone Methode

Definitie

Retourneert een duplicaat van het huidige Parameter exemplaar.

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

Retouren

Een Parameter dat een exact duplicaat is van de huidige.

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u de Parameter(Parameter) constructor aanroept van een klasse die de Parameter klasse uitbreidt om het juiste gedrag voor het klonen van objecten voor de klasse te implementeren. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de Parameter klasse.

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

Opmerkingen

Met Clone de methode wordt de Parameter(Parameter) kopieerconstructor aangeroepen om een nieuw exemplaar van de Parameter klasse te initialiseren met de waarden van het huidige exemplaar.

Als u de Parameter klasse uitbreidt, kunt u de Clone methode overschrijven om elke status op te nemen die moet worden gekopieerd naar een nieuw exemplaar van uw afgeleide klasse.

Van toepassing op

Zie ook