public static TimeSpan MeasureTime(Action action) { var s = new Stopwatch(); s.Start(); action(); s.Stop(); return s.Elapsed; }