1、
2、
System.Diagnostics.Stopwatch watch=new Stopwatch();
watch.Start();
..........
..........
watch.Stop();
watch.Elapsed;
watch.Start();
..........
..........
watch.Stop();
watch.Elapsed;
2、
DateTime oldTime=DateTime.Now;
........
........
TimeSpan ts=DateTime.Now.Subtract(oldTime);
(ts.TotalMinutes*60000).ToString();//毫秒
........
........
TimeSpan ts=DateTime.Now.Subtract(oldTime);
(ts.TotalMinutes*60000).ToString();//毫秒