title: How clear all line in text file and write new string?
body: <p>I write this code but not clear text file:</p>
  
  <pre><code>        File.WriteAllBytes(string.Concat(Server.MapPath("/"), "\\Engine\\TextFile1.txt"), new byte[0]);          
          sr = new StreamWriter(string.Concat(Server.MapPath("/"), "\\Engine\\TextFile1.txt"));
          foreach (var item in txtHtmlCode.Content.Split('\n'))
          {
              sr.Write(item + "\n");
          }
          sr.Close();
  </code></pre>
  
  <p>I use this code for clear file but not do it:</p>
  
  <pre><code>        StreamWriter sr = new StreamWriter(string.Concat(Server.MapPath("/"), "\\Engine\\TextFile1.txt"));
          sr.Flush();
          sr.Close();
  </code></pre>
  
  <p>I want clear text file and write new string in this file.What should I do?
  how to overwrite text file?</p>