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

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

类: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);


 

你可能感兴趣的:(Csharp)