Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否有一些库可以帮助编写工具,比如测量方法的执行时间_C#_.net - Fatal编程技术网

C# 是否有一些库可以帮助编写工具,比如测量方法的执行时间

C# 是否有一些库可以帮助编写工具,比如测量方法的执行时间,c#,.net,C#,.net,有没有可以帮助完成这些任务的库 您可以使用秒表类 using System; using System.Diagnostics; using System.Threading; class Program { static void Main(string[] args) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); Thread.Sleep(10000); stopWatch.S

有没有可以帮助完成这些任务的库

您可以使用秒表类

using System;
using System.Diagnostics;
using System.Threading;
class Program
{
  static void Main(string[] args)
   {
    Stopwatch stopWatch = new Stopwatch();
    stopWatch.Start();
    Thread.Sleep(10000);
    stopWatch.Stop();
    // Get the elapsed time as a TimeSpan value.
    TimeSpan ts = stopWatch.Elapsed;

    // Format and display the TimeSpan value.
    string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
        ts.Hours, ts.Minutes, ts.Seconds,
        ts.Milliseconds / 10);
    Console.WriteLine("RunTime " + elapsedTime);
}
}


-

Visual Studio有一个探查器-我认为它只在专业版和更高版本中可用。总的来说,它工作得很好

如果您有更具体或特殊的需求,您可能需要查看PostSharp或其他附加组件