String.Replace doesnt replace the original variable's value. Instead the output is saved to the new variable.
if u got no choice and still need to change it, then go for the below.
transformedMsg = transformedMsg.Replace(strxml, "");
http://msdn.microsoft.com/en-us/library/fk49wtc1.aspx[
^]
public class ReplaceTest {
public static void Main() {
string errString = "This docment uses 3 other docments to docment the docmentation";
Console.WriteLine("The original string is:{0}'{1}'{0}", Environment.NewLine, errString);
string correctString = errString.Replace("docment", "document");
Console.WriteLine("After correcting the string, the result is:{0}'{1}'",
Environment.NewLine, correctString);
}
}
Cheers
Balaji