C# 计时器

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace 计时器
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 0;
            Stopwatch sw = new Stopwatch();
            sw.Start();
            //程序开始
            for (int i = 0; i < 1000000000; i++)
            {
                x += i;
            }
            //程序结束
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds.ToString());
            Console.ReadKey();
        }
    }
}

  后续会陆续更新其他资料,喜欢请关注哦!

  我的博客:https://www.cnblogs.com/duhaoran/

原文地址:https://www.cnblogs.com/duhaoran/p/13646299.html