using System;
using System.Diagnostics;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
//...........中间代码...........
stopWatch.Stop();
TimeSpan tml = stopWatch.Elapsed;
string elapsedTime = string.Format("{0:00} 时 {1:00} 分 {2:00} 秒 {3:00}", tml.Hours, tml.Minutes, tml.Seconds, tml.Milliseconds / 10);
MessageBox.Show("所有客户提取完成!\n共耗时:" + elapsedTime, "完成提醒:");