解决方法
你可以尝试:
DateTime dt = DateTime.Now; for (.......) { } TimeSpan ts = DateTime.Now - dt; textBox1.Text = ts.TotalMilliseconds.ToString();
或者(根据MSDN)如果你需要更好的分辨率
Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); for (.......) { } stopWatch.Stop(); textBox1.Text = stopWatch.ElapsedMilliseconds.ToString();