for循环 消耗时间计算
代码如下:
Stopwatch watch = new Stopwatch(); // string msg=""; for (int i = 0; i < 16; i++) { watch.Reset(); watch.Start(); // MessageBox.Show(i.ToString()); } MessageBox.Show("耗时:" + watch.ElapsedTicks.ToString());
代码如下:
Stopwatch watch = new Stopwatch(); // string msg=""; for (int i = 0; i < 16; i++) { watch.Reset(); watch.Start(); // MessageBox.Show(i.ToString()); } MessageBox.Show("耗时:" + watch.ElapsedTicks.ToString());