That's basically the way .NET works. Objects are always passed by reference.
You could implement the ICloneable interface, and in that implementation
create a new instance of the object and "transfer" state from the local
object to the fresh instance.
Look into the ICloneable interface implementations online - google can help
you here :-)

Signature
venlig hilsen / with regards
anders borum
--
All objects are passed ByRef by default (as you said), but you can change
that by indicating that you want it to pass ByVal (at least in VB .NET, you
can).
Now, if you do this with a reference type, you'll get a copy of the pointer
that points to the object in memory (as opposed to a reference to the
original pointer). In either case, a change to the object being passed will
result in a change to the original, but when you pass a reference type
ByVal, you can change the passed object's pointer to point to something else
without affecting the original pointer. It is a subtle difference.
> That's basically the way .NET works. Objects are always passed by reference.
> You could implement the ICloneable interface, and in that implementation
[quoted text clipped - 3 lines]
> Look into the ICloneable interface implementations online - google can help
> you here :-)
Anders Borum - 22 Jun 2004 11:22 GMT
Hello!
Well, I was thinking about getting into that, but hey - thanks for pointing
it out.

Signature
venlig hilsen / with regards
anders borum
--