title: C# Save File - (Delete and re-write?)
body: <p>I am trying to create a save function in C#, which overwrites the existing file. I have the code - </p>
  
  <pre><code>public void savefile(string path)
  {
    File.Delete(path);
    File.WriteAllText(path, "Hello World");
  }
  </code></pre>
  
  <p>But there is always the possibility of the computer breaking, before the file has been saved/rewritten again, and I was wondering if there was a better way of doing it</p>
  
  <p>Should I use a saveFileDialog, which is invisible to the user instead?</p>