MtomMessageEncodingBindingElement.Clone 方法

定義

新建一個從目前 MtomMessageEncodingBindingElement 物件初始化的這類物件。Creates a new MtomMessageEncodingBindingElement object initialized from the current one.

public:
 override System::ServiceModel::Channels::BindingElement ^ Clone();
public override System.ServiceModel.Channels.BindingElement Clone ();
override this.Clone : unit -> System.ServiceModel.Channels.BindingElement
Public Overrides Function Clone () As BindingElement

傳回

屬性值與目前項目相等的 MtomMessageEncodingBindingElement 物件。A MtomMessageEncodingBindingElement object with property values equal to those of the current element.

備註

這會建立目前繫結項目物件樹狀結構的完整複本 (也稱為深層複製)。This creates a complete copy of the current binding element object tree, also called a deep clone. 物件的深層複製會建立物件的複本,以及該物件直接或間接參考之每個物件的複本,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 called copying the entire object graph.) Returning a deep clone enables the runtime to support the case in which multiple custom bindings share a custom binding element. 如果沒有傳回深層複製,則表示執行階段行為尚未定義。If a deep clone is not returned, the run-time behavior is undefined. 相較之下,物件的淺層複製則只是物件的複本。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.

適用於