using System;
using System.IO;
namespace ConsoleApplication_C_Sharp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(CountLinesInFile("d:\\data.txt"));
}
static long CountLinesInFile(string filename)
{
long count = 0;
using (StreamReader sr = new StreamReader(filename))
{
string line;
while ((line = sr.ReadLine()) != null)
count++;
}
return count;
}
}
}
/*
run:
3
*/