c#
using System.Diagnostics;
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
// do something...
stopwatch.Stop();
long spendTime = stopwatch.ElapsedMilliseconds;
注解: spendTime 就是花费的时间 (以毫秒为单位)
c#
using System.Diagnostics;
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
// do something...
stopwatch.Stop();
long spendTime = stopwatch.ElapsedMilliseconds;
注解: spendTime 就是花费的时间 (以毫秒为单位)