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), "提示");
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), "提示");