var sw = new System.Diagnostics.Stopwatch();
sw.Start();
中间为要执行的代码
sw.Stop();
var msg = "上面操作耗时" + sw.ElapsedMilliseconds + "ms";
这样就能监测代码的执行时间并进行相应的优化
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
中间为要执行的代码
sw.Stop();
var msg = "上面操作耗时" + sw.ElapsedMilliseconds + "ms";
这样就能监测代码的执行时间并进行相应的优化
转载于:https://www.cnblogs.com/boosasliulin/p/5662822.html