c# counting lines
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"));
}
Also in C#:
- unknown discriminator value mongodb
- mysql executeScalar only if successful
- c# change variable types
- percentage in c#
- c# listview
- c# substring reverse
- month number to text in c#
- unity prevent system from creation
- generic repository pattern c#
- how to display an image url in c# picturebox
- using serial port in c#
- c sharp if string equals
- decalre an int list mvc
- how can convert string to int csharp
- unity to integer
- string to guid c#
- how to draw a dot in c#
- play animation through script unity
- c# empty IEnumerable
- how to reference scripts in other scenes unity
- how to reference a child object unity
- switch statement
- @Html.ActionLink
- use enter key unity