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

반품

A Parameter 는 현재 항목과 정확히 중복됩니다.

예제

다음 코드 예제에서는 클래스에 대 한 올바른 개체 복제 동작을 구현 하는 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 새 인스턴스를 초기화합니다.

클래스를 확장하는 경우 파생 클래스의 ParameterClone 새 인스턴스에 복사해야 하는 상태를 포함하도록 메서드를 재정의할 수 있습니다.

적용 대상

추가 정보