Hashtable.Clone 方法

定义

创建 Hashtable 的浅表副本。Creates a shallow copy of the Hashtable.

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

返回

Hashtable 的浅表副本。A shallow copy of the Hashtable.

实现

注解

集合的浅表副本仅复制集合的元素,无论它们是引用类型还是值类型,但不复制引用引用的对象。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.

@No__t-0 克隆具有相同的计数、相同的容量、相同的 @no__t 1 实现和与原始 @no__t 3 相同的 IComparer 实现。The Hashtable clone has the same count, the same capacity, the same IHashCodeProvider implementation, and the same IComparer implementation as the original Hashtable.

此方法是 @no__t 0 操作,其中 n CountThis method is an O(n) operation, where n is Count.

适用于

另请参阅