Stopwatch utilities : Stopwatch « Development Class « C# / C Sharp






Stopwatch utilities

        

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

public class Helpers
{
    public static long TimeFunction(Action action)
    {
        var sw = new Stopwatch();
        sw.Start();
        action.Invoke();
        sw.Stop();
        return sw.ElapsedMilliseconds;
    }

}

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Use Stopwatch