现在的位置: 首页 > 综合 > 正文

获取当前实例测量得出的总运行时间(以毫秒为单位)。

2013年11月05日 ⁄ 综合 ⁄ 共 320字 ⁄ 字号 评论关闭

获取当前实例测量得出的总运行时间(以毫秒为单位)。

类:System.Diagnostics.Stopwatch

程序集:

#region 程序集 System.dll, v4.0.30319
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll
#endregion

 示例代码:

			var sw = Stopwatch.StartNew();

			for (var i = 0; i < times; i++)
			{
				//Do Sth
			}

			Debug.WriteLine("Do Sth Completed in ms: " + sw.ElapsedMilliseconds);

 

【上篇】
【下篇】

抱歉!评论已关闭.