C#代码计时

using System.Diagnostics;

 

Stopwatch sw = new Stopwatch();
sw.Start(); 
//todo code ....... 
sw.Stop();
Console.WriteLine("执行此段代码耗时:{0} ms", sw.ElapsedMilliseconds);

 

posted @ 2014-03-11 11:07  songtzu  阅读(240)  评论(0编辑  收藏  举报