Stopwatch定时器测量代码中不同任务执行时间

 Stopwatch sw = new Stopwatch();
  sw.Start();
  //任务123
  Console.WriteLine("{0, 4}ms",sw.Elapsed.TotalMilliseconds);
//MessageBox.Show(string.Format("查询耗时{0, 4}ms", sw.Elapsed.TotalMilliseconds), "提示");

 

posted on 2021-02-14 11:23  RookieBoy666  阅读(71)  评论(0编辑  收藏  举报