//定义一个时间对象
System.Diagnostics.Stopwatch oTime = new System.Diagnostics.Stopwatch();
oTime.Start(); //记录开始时间
for (int i = 0; i < 10000; i++) {
int a = i + 25160;
int b = a - 1000;
}
Thread.Sleep(1500);
oTime.Stop(); //记录结束时间
MessageBox.Show(oTime.Elapsed.Seconds+"秒"+oTime.Elapsed.Milliseconds + "毫秒");