BindingElement.Clone 方法


在衍生類別中覆寫時,傳回繫結項目物件的複本。When overridden in a derived class, returns a copy of the binding element object.

 abstract System::ServiceModel::Channels::BindingElement ^ Clone();
public abstract System.ServiceModel.Channels.BindingElement Clone ();
abstract member Clone : unit -> System.ServiceModel.Channels.BindingElement
Public MustOverride Function Clone () As BindingElement


BindingElement 物件,其為原始物件的深層複製。A BindingElement object that is a deep clone of the original.


實作 Clone 方法,以傳回繫結項目的深層複製。Implement the Clone method to return a deep clone of your binding element. 傳回複製可讓執行階段支援多個自訂繫結共用自訂繫結項目的情況。Returning a clone enables the runtime to support the case in which multiple custom bindings share a custom binding element. 如果沒有傳回複製,則表示執行階段行為尚未定義。If a clone is not returned, the run-time behavior is undefined.

物件的深層複製會建立物件的複本,以及該物件直接或間接參考之每個物件的複本,A deep clone of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object. (這也稱為複製整個物件圖形)。相反地,物件的淺層複製只是物件的複本。(This is also called copying the entire object graph.) A shallow clone of an object, by contrast, is a copy of the object only. 如果物件包含其他物件的參考,則淺層複製不會建立所參考之物件的複本,而只會複製原始物件的參考。If the object contains references to other objects, the shallow copy does not create copies of the referred objects; instead, it copies only the references to the original objects.