In your code insert @ proerly so that your code will work
<pre lang="cs">string text = File.ReadAllText(@"c:\trial.log");
text = text.Replace("ResultCode", "HI New value ");
File.WriteAllText(@"c:\trial.log", text);</pre>