You passed a reference to a string. You did not pass a reference to a variable. If you want to change a variable then you do it like this:
private void ReplaceIfEmpty(ref string originalValue, string newValue) ...
The difference is frequently confusing to people. Think about it this way. Instead of imagining a string, imagine two houses. Now imagine two pieces of paper that have the addresses of those houses; those are references to the houses. And now imagine four drawers that each contain a piece of paper. The drawers are labelled p, q, x and y:
void M(House x, House y)
{
x = y;
}
...
House p = new House("123 Sesame Street");
House q = new House("1600 Pennsylvania Avenue");
M(p, q);
What does this program do? You put a piece of paper that says "123 Sesame Street" in drawer p. You put a piece of paper that says "1600 Pennsylvania Avenue" in drawer q.
You make a photocopy of the paper in drawer p and put the copy in drawer x. You make a photocopy of the paper in drawer q and put the copy in drawer y. And then you call M. M makes a photocopy of what's in drawer y and puts it in drawer x. Drawer p is not affected.
Now consider this case:
void M(ref House r, House s)
{
r = s;
}
...
House p = new House("123 Sesame Street");
House q = new House("1600 Pennsylvania Avenue");
M(ref p, q);
What does this program do? You put a piece of paper that says "123 Sesame Street" in drawer p. You put a piece of paper that says "1600 Pennsylvania Avenue" in drawer q.
You put a sticky note on drawer p that says "this drawer is also called r".
You make a photocopy of the paper in drawer q and put the copy in drawer s.
And then you call M. M makes a photocopy of what's in drawer s and puts it in drawer r, which is the same as drawer p.
Make sense?