maintain string reference

  • Thread starter Thread starter Michael Wong
  • Start date Start date
M

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"
 
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
 
Back
Top