Hashtable.Clone Método

Definição

Cria uma cópia superficial do 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

Retornos

Object

Uma cópia superficial do Hashtable.A shallow copy of the Hashtable.

Implementações

Comentários

Uma cópia superficial de uma coleção copia apenas os elementos da coleção, sejam eles tipos de referência ou tipos de valor, mas não copia os objetos aos quais as referências se referem.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. As referências na nova coleção apontam para os mesmos objetos aos quais as referências na coleção original apontam.The references in the new collection point to the same objects that the references in the original collection point to.

Por outro lado, uma cópia profunda de uma coleção copia os elementos e tudo o que é diretamente ou indiretamente referenciado pelos elementos.In contrast, a deep copy of a collection copies the elements and everything directly or indirectly referenced by the elements.

O Hashtable clone tem a mesma contagem, a mesma capacidade, a mesma IHashCodeProvider implementação e a mesma IComparer implementação do original Hashtable .The Hashtable clone has the same count, the same capacity, the same IHashCodeProvider implementation, and the same IComparer implementation as the original Hashtable.

Esse método é uma O(n) operação, em que n é Count .This method is an O(n) operation, where n is Count.

Aplica-se a

Confira também