ArrayList.Clone 方法

定義

建立 ArrayList 的淺層複本。Creates a shallow copy of the ArrayList.

public:
 virtual System::Object ^ Clone();
public virtual object Clone ();
abstract member Clone : unit -> obj
override this.Clone : unit -> obj
Public Overridable Function Clone () As Object

傳回

ArrayList 的淺層複本。A shallow copy of the ArrayList.

實作

備註

集合的淺層複本只會複製集合的元素,不論它們是參考型別或實數值型別,但不會複製參考所參考的物件。A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but it does not copy the objects that the references refer to. 新集合中的參考會指向原創組合中參考所指向的相同物件。The references in the new collection point to the same objects that the references in the original collection point to.

相反地,集合的深層複本會複製專案,以及元素直接或間接參考的所有專案。In contrast, a deep copy of a collection copies the elements and everything directly or indirectly referenced by the elements.

這個方法是 O(n) 作業,其中 nCountThis method is an O(n) operation, where n is Count.

適用於