p; total += i; } } } } 添加Stopwatch对象: Stopwatch类位于System.Diagnostics命名空间。下面是添加对象后的代码: using System; using System.Diagnostics;
namespace StopWatchClass { class Program { static void Main(string[] args) { Stopwatch timer = new Stopwatch(); long total = 0;
for (int i = 1; i <= 10000000; i++) { total += i; } } } } 控制Stopwatch对象: 上一页 [1] [2] [3] [4] [5] 下一页 |