using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace Example
{
public class Program
{
static void Main(string[] args)
{
int sum=0;
//Stopwatch提供一组方法和属性,可用于准确地测量运行时间
Stopwatch sw = new Stopwatch();
sw.Start();
//业务逻辑
sw.Stop();
//获取当前实例测量得出的总运行时间
TimeSpan dt = sw.Elapsed;
Console.WriteLine("程序耗时:'{0}'秒", dt.TotalMilliseconds);
}
}
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交