文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C# 对某一部分代码执行时间进行检测

C# 对某一部分代码执行时间进行检测

时间:2010-09-01  来源:livenn

  sealed class CommandTimer : IDisposable
  {
   Stopwatch commandStopwatch = new Stopwatch();

   internal CommandTimer(string command)
   {
    commandStopwatch.Start();
   }

   public void Dispose()
   {
    commandStopwatch.Stop();
    Console.WriteLine("\nCommand elapsed time: {0} sec", commandStopwatch.ElapsedMilliseconds / 1000f);
   }
  }

 

使用如下:

    using (CommandTimer t = new CommandTimer("-----"))
    {
    。。。。。。。。。。。。。。
    }

相关阅读 更多 +
排行榜 更多 +
binance交易所2025

binance交易所2025

金融理财 下载
安币binance华为下载

安币binance华为下载

金融理财 下载
binanceapp官方正版下载

binanceapp官方正版下载

金融理财 下载