I would like to count number of lines in a file based on crlf (0D0A) count. My current code only counting the number of lines based on cr (0D). Can anybody give suggestion ?
public static int Countline(string file)
{
var lineCount = 0;
using (var reader = File.OpenText(file))
{
while (reader.ReadLine() != null)
{
lineCount++;
}
}
return lineCount;
}
