On Sat, 26 Nov 2005 16:26:02 +0200, "BenW" <bmw@mailer.smart.com>
wrote:
[color=blue]
>What is the easiest way to make "deep copy" of my Hashtable?[/color]
There is no easy way. You must define your own deep copy method on
the element type of your hashtable, and an additional deep copy method
for your hashtable that calls the element copy method on all elements.
[color=blue]
>How about with other Collection classes in C#, any documents available?[/color]
No documents, same as above. The Framework does not support any deep
copies of collections by default.
[color=blue]
>I don'r actually understand why Framework's Collection classes does not
>support deep copy methods by theself, only Clone with shallow copy.[/color]
A standard deep copy support would have to be ubiquitous. Collections
can contain anything, and that "anything" could be a type that
contains other nested objects, and so on. A deep copy must recurse
through all those levels. The Framework designers didn't provide a
default deep copy method on System.Object, hence they couldn't very
well provide one for System.Collections types (how to copy elements?).
--
http://www.kynosarges.de