title: Delete the last line of a StreamWriter?
body: <p>I know that when we use a StreamWriter this is, by definition, to write in it but the fact is that at some point I can have the obligation to delete the last line of my streamwriter...</p>
  
  <p>I found the following code (on SO) that works well :</p>
  
  <pre><code>var lines = System.IO.File.ReadAllLines(pluginQmlFileName);
  System.IO.File.WriteAllLines(pluginQmlFileName, lines.Take(lines.Length - 1).ToArray());
  </code></pre>
  
  <p>but the thing is that I can't use it in my :</p>
  
  <pre><code>using (StreamWriter sw = new StreamWriter(pluginQmlFileName, true))
  {
      [...]
  }
  </code></pre>
  
  <p>section.</p>
  
  <p>Is there a way to delete the last line in the <code>using {}</code> section or do I have to keep my actual code ?</p>