Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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);
        }