String Replace does not work correctly


This is my method that is supposed to return a parsed document.

public string GetParsedDocument(string Document)
   Document.Replace("{{tag}}", ParseMarkup(Tag.Text));
   return Document

Basically I parse the document and write it to a file like this:

System.IO.File.WriteAllText(SaveDialog.FileName, GetParsedDocument(TestProgram.Properties.Resources.Document));

Yet when I open the file, non of my changes are there. What's going on? I've tried making the strings verbatim and I've tested to see if it's any of the other components that aren't working; but it isn't. String replace is not working. Or it's not returning properly. Any ideas?

Strings are immutable, so all its methods return the new string as a result. You should go like this:

string parsedDocument = Document.Replace("{{tag}}", ParseMarkup(Tag.Text));
return parsedDocument;