title: What's the most efficient way of implementing ReadLine() on a binary stream?
body: <p>Please feel free to correct me if I am wrong at any point...</p>
  
  <p>I am trying to read a <a href="http://en.wikipedia.org/wiki/Comma-separated_values" rel="nofollow noreferrer">CSV</a> (comma separated values) file using .NET file I/O classes. Now the problem is, this CSV file may contain some fields with soft carriage returns (i.e. solitary \r or \n markers rather than the standard \r\n used in text files to end a line) within some fields and the standard text mode I/O class StreamReader does not respect the standard convention and treats the soft carriage returns as hard carriage returns thus compromising the integrity of the CSV file. </p>
  
  <p>Now using the BinaryReader class seems to be the only option left but the BinaryReader does not have a ReadLine() function hence the need to implement a ReadLine() on my own. </p>
  
  <p>My current approach reads one character from the stream at a time and fills a StringBuilder until a \r\n is obtained (ignoring all other characters including solitary \r or \n) and then returns a string representation of the StringBuilder (using ToString()). </p>
  
  <p>But I wonder: is this is the most efficient way of implementing the ReadLine() function? Please enlighten me.</p>