title: How do I count the number of bytes read by TextReader.ReadLine()?
body: <p>I am parsing a very large file of records (one per line, each of varying length), and I'd like to keep track of the number of bytes I've read in the file so that I may recover in the event of a failure.</p>
  
  <p>I wrote the following:</p>
  
  <pre><code>using (TextReader myTextReader = CreateTextReader())
  {
      string record = myTextReader.ReadLine();
      bytesRead += record.Length;
      ParseRecord(record);
  }
  </code></pre>
  
  <p>However this doesn't work since <code>ReadLine()</code> strips any CR/LF characters in the line.  Furthermore, a line may be terminated by either CR, LF, or CRLF characters, which means I can't just add 1 to <code>bytesRead</code>.</p>
  
  <p>Is there an easy way to get the actual line length, or do I write my own <code>ReadLine()</code> method in terms of the granular <code>Read()</code> operations?</p>