public static string InvokeStopwatch(Action function) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); //开始执行业务代码 Retry.Execute(function, new TimeSpan(0, 0, 2)); sw.Stop(); return (sw.ElapsedMilliseconds / 1000.0f).ToString(); }