Quick snippet to let you check the time used by any method you have.

public static void CalculateTime( Action method )
{
    Stopwatch chrono = new Stopwatch();
    chrono.Start();

    method.Invoke();
            
    chrono.Stop();
    Console.WriteLine("Method : " + method.Method.Name + ", Time: " + chrono.ElapsedMilliseconds + " (ms)");
}

This will write to the console the time spent on the method.

DiagnosticStaticClass.CalculateTime( MyExpensiveMethod );

Just remember to use System.Diagnostics.
More info on Stopwatch.

That’s it. Enjoy.