C#计算执行时间
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); //开始测量或继续测量 stopwatch.Start(); //停止测量 stopwatch.Stop(); //重置测量 stopwatch.Reset(); //重置并重新开始测量 stopwatch.Restart(); //总运行毫秒数,可多次分段取 double TotalMilliseconds = stopwatch.Elapsed.TotalMilliseconds;