title: C# - Appending text files
body: <p>I have code that reads a file and then converts it to a string, the string is then written to a new file, although could someone demonstrate how to append this string to the destination file (rather than overwriting it)</p>
  
  <pre><code>private static void Ignore()
  {
      System.IO.StreamReader myFile =
         new System.IO.StreamReader("c:\\test.txt");
      string myString = myFile.ReadToEnd();
  
      myFile.Close();
      Console.WriteLine(myString);
  
      // Write the string to a file.
      System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test2.txt");
      file.WriteLine(myString);
  
      file.Close();
  }
  </code></pre>