码迷,mamicode.com
首页 > Windows程序 > 详细

C#测量程序时间差

时间:2015-06-19 13:34:41      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:


<span style="font-size:14px;">using System;  
using System.Collections.Generic;  
class Sentence  
{  
  static void Main()  
  {  
    double ticks0 = DateTime.Now.Ticks;
    for (int i = 0; i < int.MaxValue; i++) 
    {
      // ...  
    }
    double ticks1 = DateTime.Now.Ticks;
    double n = (ticks1 - ticks0) / 10000000;  
    Console.WriteLine("上面这段程序运行了{0}秒", n);
    Console.ReadLine();
  }
}</span>


C#测量程序时间差

标签:

原文地址:http://blog.csdn.net/ilipan/article/details/46560159

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!