title: StreamReader.EndOfStream missing last line?
body: <p>I am trying to read a text file using the code (pasted below), but the last line of the file does not get read.  Is my logic correct?</p>
  
  <pre><code>        using (StreamReader reader = new StreamReader(stream))
          {
              try
              {
                  string line = reader.ReadLine();
                  string[] data = BreakLine(line);  
  
  
                  while (!reader.EndOfStream)
                  {
                      data = BreakLine(line);
                      DataRow dr = _DataTable.NewRow();
                      // protect against overflow
                      int maxColumns = Math.Min(_DataTable.Columns.Count, data.Length);
                      for (int i = 0; i &lt; maxColumns; i++)
                      {
                          dr[i] = data[i];
                      }
                      _DataTable.Rows.Add(dr);
                      line = reader.ReadLine();
                  }
                  return _DataTable;
              }
              finally
              {
                  reader.Close();
                  reader.Dispose();
                  stream.Close();
              }
          }
  </code></pre>