title: Using the "using" statement with StreamWriter/Reader inside loop
body: <p>Here is my situation. </p>
  
  <ol>
  <li>Read one line from a text file</li>
  <li>"Process" the line</li>
  <li>Write the "processed" line to a new text file</li>
  <li>Loop to #1 and repeat until EOF</li>
  </ol>
  
  <p>Here is how I'm doing it:</p>
  
  <pre><code>using (StreamReader srReader = new StreamReader(strInputFile))
  {
      // loop until EOF
      while ((strCurrentLine = srReader.ReadLine()) != null)
      {
          // "process" strCurrentLine...
  
          // write the "processed" strCurrentLine to a new text file
          using (StreamWriter sw = new StreamWriter(strFullOutputPathFileName, false))
          {
              // write strCurrentLine to the new file
              sw.WriteLine("stuff...");
          }
       }
  }
  </code></pre>
  
  <p>My manager tells me that using the <code>using</code> statement like I am inside of a loop will extremely hinder performance. The reason is because the <code>StreamWriter</code> instance will be created as many times as I'm looping. So, if I looped 1,000 times, I'd have 1,000 instances of my <code>StreamWriter</code> object, which could severely hinder performance.</p>
  
  <p>Is this true? Also, is my method above the best way to accomplish this?</p>