时间差计算 Stopwatch

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      Stopwatch s = new Stopwatch();
      s.Start();
      for (int i = 0; i < 100000000; i++)
      {
        string ss = i.ToString();
        Console.WriteLine(ss);
      }

      s.Stop();
      Console.WriteLine(s.ElapsedMilliseconds/1000+"秒");
      Console.ReadLine();
    }
  }
}

posted @ 2015-04-22 14:50  YyuTtian  阅读(155)  评论(0编辑  收藏  举报