Parameter.Clone 方法

定義

回傳一個與目前 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

傳回

Parameter A 是目前的完全複製品。

範例

下列程式代碼範例示範如何從擴充 Parameter(Parameter) 類別的 類別呼叫 Parameter 建構函式,以實作 類別的正確物件複製行為。 此程式碼範例是本類別更大範例 Parameter 的一部分。

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

備註

Clone 方法呼叫 Parameter(Parameter) 複製建構子,以目前實例的值初始化該類別的新實例 Parameter

如果你擴充類別, Parameter 可以覆寫該 Clone 方法,包含任何應該複製到你衍生類別新實例的狀態。

適用於

另請參閱