When I use only \\r
as a line terminator, the StreamReader.ReadLine()
method doesn\'t work. It works if I use Environment.NewLine
, \
I solved the problem with my own ReadLine method
public static class StreamReaderExtensions
{
public static string ReadLineSingleBreak(this StreamReader self)
{
StringBuilder currentLine = new StringBuilder();
int i;
char c;
while ((i = self.Read()) >= 0)
{
c = (char)i;
if (c == '\r'
|| c == '\n')
{
break;
}
currentLine.Append(c);
}
return currentLine.ToString();
}
}