Measure function time

CSharp · Console

/Program.cs

using System;
using System.Diagnostics;
					
public class Program
{
	public static void Main()
	{
		var stopwatch = new Stopwatch();
		stopwatch.Start();
		Foo();
		stopwatch.Stop();
		var t = stopwatch.ElapsedMilliseconds;
		Console.WriteLine($"Elapsed {t}");
	}
	
	public static void Foo() {
		for(var i = 0; i < 1000; i++) {
			Console.Write(".");
		}
		Console.WriteLine("Done");
	}
}
;