编程语言
首页 > 编程语言> > C#计时器代码

C#计时器代码

作者:互联网

C#写计时器:

System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
watch.Start();//开始计时
       
int count=0;
for (int i = 0; i < 10000; i++)
{
count++;
}
watch.Stop();//停止计时

Console.WriteLine("共耗时:" + (watch.ElapsedMilliseconds));//输出时间--毫秒

Console.ReadKey();

标签:Console,C#,代码,watch,System,int,计时器,Diagnostics,Stopwatch
来源: https://www.cnblogs.com/nn1314/p/14147774.html