title: StreamReader get next line and skip over empty lines
body: <p>I'm reading a file using a StreamReader. These files sometimes have empty lines between other lines. The number of empty lines in-between can be any number. What's the best way to have my StreamReader skip over all empty lines until a non-empty line is read?</p>
  
  <p>I have a function that I call in a while loop:</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Moves the stream to the next non-empty line, and returns it. 
  /// &lt;/summary&gt;
  /// &lt;param name="srFile"&gt;&lt;/param&gt;
  private string GetNextLine(StreamReader srFile)
  {
      string line = srFile.ReadLine();
      if (String.IsNullOrWhiteSpace(line))
          GetNextLine(srFile);
      return line;
  }
  </code></pre>
  
  <p>Everything seems fine, but for some reason this doesn't work. Whenever line isn't empty, the return line does indeed get hit, but for some reason more recursive 'GetNextLine()' calls are made. Can anyone see what I'm doing wrong, or offer a solution?</p>