Stopwatch C#

using System.Diagnostics; using System.Threading.Tasks; using System;

class Test 
{
    static void Main() 
    {
        var watch = new Stopwatch();
        watch.Start();
        
        using (var task = Task.Delay(5000))
        {
            task.Wait();
        }
        
        watch.Stop();
        
        Console.WriteLine("Time elapsed ... " + watch.Elapsed);
    }
}

Comments