Home All Groups Group Topic Archive Search About

maintain string reference

Author
15 Jul 2006 11:08 AM
Michael Wong
Hi,

I would like to have a string point to another one.
What I mean is I want the pointing to change value whenever the pointed
one is changed. How can I do it?

Example:

string orgString = "Original string";
string ptrString = orgString;

orgString = "New string";

// Now, we have ptrString == "Original string"

// I would instead want this:
// ptrString == "New string"

Author
15 Jul 2006 1:24 PM
Michael Nemtsev
Hello Michael,

That's because strings are immutable. You need to use StringBuilder for that

I recoment you to read this http://www.yoda.arachsys.com/csharp/strings.html

MW> would like to have a string point to another one.
MW> What I mean is I want the pointing to change value whenever the
MW> pointed
MW> one is changed. How can I do it?
---
WBR,
Michael  Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

AddThis Social Bookmark Button