title: What's the difference between using EndOfStream and checking for null?
body: <p>I am in the process of writing a large application which involves a bit of streaming from either a process or file streams. I have 2 examples below of different ways to detect the end of a stream. I was curious as to what the difference is and which one is best to use? Is there any difference in efficiency or performance? Also, in the .NET reference guide, I noticed they check for null in methods such as <code>ReadAllLines</code> which streams from a file (similar to Example 2 below), so why don't they use <code>EndOfStream</code>?</p>
  
  <p><strong>Example 1:</strong> </p>
  
  <pre><code>...
  StreamReader std_out = myProcess.StandardOutput;
  
  while (!std_out.EndOfStream)
  {
      string rLine = std_out.ReadLine();
      //Do something...
  }
  ...
  </code></pre>
  
  <p><strong>Example 2:</strong></p>
  
  <pre><code>...
  string rLine;
  StreamReader std_out = myProcess.StandardOutput;
  
  while ((rLine = std_out.ReadLine()) != null)
  {
      //Do something...
  }
  ...
  </code></pre>
  
  <p>Cheers.</p>