title: C# windows forms application:How can I replace a single line in a textfile without deleting the original file?
body: <p>I am making a project that uses streamreader and streamwriter, Is it possible that I only replace or save a text in an specific line only without affecting the other lines? 
  if I make like this</p>
  
  <pre><code>streamreader sr = new streamreader(@"txtfile");
  list&lt;string&gt; lines = new list&lt;string&gt;();
  while (!sr.EndOfStream)
  sr.readline();
  {
       lines.Add(sr.ReadLine();
  }
  
  //put in textbox
  sr.close();
  
  {
  streamwriter sw = new streamwriter(@"txtfile");
  sw.WriteLine(textBox1.text);
  sw.close();
  }
  </code></pre>
  
  <p>this is just a sample, but Is it possible that I use list also un streamwriter?</p>