public static IndexResult GetResult(Action action) { var stopwatch = Stopwatch.StartNew(); var indexResult = new IndexResult(); try { action(); } catch (Exception ex) { indexResult.AddError(ex.Message); } stopwatch.Stop(); indexResult.ExecutionTime = stopwatch.ElapsedMilliseconds; return indexResult; }
public static IndexResult GetResult(Action action) { var stopwatch = Stopwatch.StartNew(); var indexResult = new IndexResult(); try { action(); } catch (Exception ex) { indexResult.AddError(ex.Message); } stopwatch.Stop(); indexResult.ExecutionTime = stopwatch.ElapsedMilliseconds; return(indexResult); }