title: Performing operations after reading the last line of a file with a StreamReader
body: <p>I am using a <code>StreamReader</code> to read lines from a text file. For each line I have specific operations that are performed. </p>
  
  <p>Example:</p>
  
  <pre><code>System.IO.StreamReader file = new System.IO.StreamReader(fileDirectory); //Open StreamReader
  while ((inFileString = file.ReadLine()) != null)
  {
      if(something)
      { do stuff... }
  }
  </code></pre>
  
  <p>My problem occurs after the last line is read, because the code inside the <code>while</code> loop becomes inaccessible. It's basically like I need to be allowed to go through the <code>while</code> loop one more time, after it automatically exits. How do I perform my operations on the last line read from the file?</p>
  
  <p>(I could just replicate the operations outside of the loop, but I figured that would be inefficient...)</p>