Utility components Clone
Creates a copy of the current collection recursively. 



IDL definition:

[id(16)] HRESULT Clone([out,retval] IDispatch** ppClone);


object - Previously created VarDictionary object


Set theCopy = vardict.Clone


This method will create new VarDictionary collection, configure it to behave as the collection being cloned - e.g. copy the Missing, Root values, and the behaviour properties. Then it copies all the items to the new collection and a certain item contains another VarDictionary collection it will be cloned too and the copy will appear in the new collection. The other objects potentially contained in the collection will not be copied - a reference to them will be placed in the new collection instead.

This means that if you have a tree of VarDictionary collections it will be copied entirely. For example think of a collection of values (strings, numbers), and some other VarDictionary objects (containing other values and other VarDictionary objects and so on). It will be tree of scalar values and sub-collection which are VarDictionaries too. Such a tree will be copied and the new copy will be independent - any changes made to it will not affect the original tree.

What if the collection contains references to other objects - such as some ADODB objects or FileStreams or any other kind of ActiveX? There is no way to clone such an object. Windows does not define standard cloning mechanism for the ActiveX objects thus it is impossible to make true copy of such objects. The clone method will copy only a reference to the object contained in the original collection and thus any change to this object through of the both collections (copy and the original) will affect the same object.

Applies to: VarDictionary

newObjects Copyright 2001-2005 newObjects [ ]