标签:style http color os 使用 strong for ar art
在.NET中,使用StopWatch类(中文为秒表,非常形象)可以很方便的统计执行时间,示例如下:
using System; using System.Diagnostics; using System.Threading; class Program { static void Main(string[] args) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Thread.Sleep(10000); stopWatch.Stop(); // Get the elapsed time as a TimeSpan value. TimeSpan ts = stopWatch.Elapsed; // Format and display the TimeSpan value. string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); Console.WriteLine("RunTime " + elapsedTime); } }
需要更详细的介绍请参考:http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v=vs.110).aspx
标签:style http color os 使用 strong for ar art
原文地址:http://www.cnblogs.com/powerme/p/3936656.html