title: how to write to beginning of file with Stream Writer?
body: <p>I want to insert my string to the beginning of the file. But there is no function to append in beginning in stream writer. So how should I do that ?   </p>
  
  <p>My code is :  </p>
  
  <pre><code>string path = Directory.GetCurrentDirectory() + "\\test.txt";
  StreamReader sreader = new StreamReader(path);
  string str = sreader.ReadToEnd();
  sreader.Close();
  
  StreamWriter swriter = new StreamWriter(path, false);
  
  swriter.WriteLine("example text");
  swriter.WriteLine(str);
  swriter.Close();
  </code></pre>
  
  <p>But it doesn't seem optimized. So is there any other way ?</p>