ByRef Object. Memberwise Clone(Boolean) 方法
protected: MarshalByRefObject ^ MemberwiseClone(bool cloneIdentity);
protected MarshalByRefObject MemberwiseClone (bool cloneIdentity);
override this.MemberwiseClone : bool -> MarshalByRefObject
Protected Function MemberwiseClone (cloneIdentity As Boolean) As MarshalByRefObject
false，刪除目前 MarshalByRefObject 物件的識別 (Identity)，則會在跨遠端界限進行封送處理時將新的識別指定給物件。
false to delete the current MarshalByRefObject object's identity, which will cause the object to be assigned a new identity when it is marshaled across a remoting boundary.
false 的值通常是適當的。A value of
false is usually appropriate.
true 表示會將目前 MarshalByRefObject 物件的識別複製到其複製品，而造成將遠端用戶端呼叫傳送至遠端伺服器物件。
true to copy the current MarshalByRefObject object's identity to its clone, which will cause remoting client calls to be routed to the remote server object.
MemberwiseClone(Boolean) 方法會建立新的 MarshalByRefObject 物件，然後將目前 MarshalByRefObject 物件的非靜態欄位複製到新的物件，藉以建立淺層複本。The MemberwiseClone(Boolean) method creates a shallow copy by creating a new MarshalByRefObject object, and then copying the nonstatic fields of the current MarshalByRefObject object to the new object. 如果欄位是實值型別，則會執列欄位的逐位複製。If a field is a value type, a bit-by-bit copy of the field is performed. 如果欄位是參考型別，則會複製參考，但參照的物件則不會。因此，原始物件和其複製會參考相同的物件。If a field is a reference type, the reference is copied but the referred object is not; therefore, the original object and its clone refer to the same object.
例如，假設有一個名為 X 的 MarshalByRefObject 物件，它會參考物件 A 和 B。物件 B 接著會參考物件 C。X 的淺層複本會建立新的物件 X2，同時參考物件 A 和 B。相反地，X 的深層複本會建立新的物件 X2，參考新的物件 A2 和 B2，而這是 A 和 B 的複本。然後，它會參考新的物件 C2，也就是複製 C。請使用可執行 ICloneable 介面的類別，以執行物件的深層或淺層複本。For example, consider a MarshalByRefObject object called X that references objects A and B. Object B, in turn, references object C. A shallow copy of X creates new object X2 that also references objects A and B. In contrast, a deep copy of X creates a new object X2 that references the new objects A2 and B2, which are copies of A and B. B2, in turn, references the new object C2, which is a copy C. Use a class that implements the ICloneable interface to perform a deep or shallow copy of an object.
MarshalByRefObject 物件的識別會定義為遠端伺服器物件，也就是遠端用戶端呼叫的目標。The identity of a MarshalByRefObject object is defined as the remote server object that is the target of a remoting client call. 根據預設，MarshalByRefObject 物件的成員複製品與原始物件具有相同的身分識別，這通常不是將跨遠端邊界封送處理的伺服器端物件複製到用戶端的正確行為。By default, the memberwise clone of a MarshalByRefObject object has the same identity as the original object, which is typically not the correct behavior for clones of server-side objects that are marshaled across a remoting boundary to the client side. 指定
true，使複製保留原始 MarshalByRefObject 物件的識別。Specify
false, which is usually appropriate, to delete the identity of the clone and cause a new identity to be assigned when the clone is marshaled across a remoting boundary, or
true to cause the clone to retain the identity of the original MarshalByRefObject object. MemberwiseClone(Boolean) 方法可供開發人員用來執行遠端伺服器物件。The MemberwiseClone(Boolean) method is intended to be used by developers implementing remote server objects.