c# counting lines

C#
public long CountLinesLINQ(FileInfo file)  
    => File.ReadLines(file.FullName).Count();
private void Benchmark(FileInfo file)  
{
    Console.WriteLine(nameof(CountLinesLINQ));

    var sw = Stopwatch.StartNew();
    var count = CountLinesLINQ(file);
    sw.Stop();

    Console.WriteLine("{0} | {1} | Gen0 - {2} | Gen1 - {3} | Gen2 - {4}",
        file.Name,
        sw.Elapsed.ToString(),
        GC.CollectionCount(0).ToString("N0"),
        GC.CollectionCount(1).ToString("N0"),
        GC.CollectionCount(2).ToString("N0"));
}
Source

Also in C#: