This has probably been asked before but I can't find it. I don't think my googlefu is good enough. Anyway,
Say I have this:
string cat = "meow"
cat = cat.replace("meow","purr");
cat = Regex.Replace(cat, "purr", "Meow!");
It seems extra to be setting the cat variable to a manipulated copy of it. Is there a way to do this in a pass by ref way so that I don't have to set the variable to the modified version of itself?
To be clear it's lines 2 and 3 above that I'm asking about here.
EDIT: I don't believe the marked dupe is an EXACT dupe of my question. My question is specific to the inquiry of the existence of such a thing. The linked post is specific to an explanation of why it DOESN'T exist. This question is probably still worth keeping for those who aren't familiar with the immutable concept.