C#计算代码段运行时间

Stopwatch sw= new Stopwatch();
sw.Start();

//do something
sw.Stop();  

Console.WriteLine(sw.Elapsed.TotalMilliseconds);

 

参考:http://www.cnblogs.com/ajax-cn/archive/2007/04/14/713179.html

转载于:https://www.cnblogs.com/lbsx/archive/2010/05/12/1733966.html

你可能感兴趣的:(C#计算代码段运行时间)