统计方法执行时间

 

引用:using System.Diagnostics;

Stopwatch timer = Stopwatch.StartNew();

....(要计时的方法)

timer.Stop();
LogHelper.Info("此方法花费时间为:" + timer.Elapsed.TotalSeconds.ToString() + "秒");

原文地址:https://www.cnblogs.com/moss_tan_jun/p/1950589.html