zoukankan      html  css  js  c++  java
  • .NET监视程序运行时间

    使用Stopwatch类(命名空间:System.Diagnostics;)

    示例:

    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using SFast;
    using System.Diagnostics;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                var sw = new Stopwatch();
                sw.Start();
                List<Employee> employees = new List<Employee>
                {
                    new Employee {ID = 1, Name = "Ringgo"},
                    new Employee {ID = 2, Name = "Rex"},
                    new Employee {ID = 1, Name = "Ringgo"}
                };
                var reslut = employees.Distinct();
                sw.Stop();
                Console.WriteLine(sw.ElapsedTicks);
                Console.WriteLine(reslut._ToJsonStr());
                Console.ReadKey();
            }
        }
    }
    

     结果:

  • 相关阅读:
    uva1220--树的最大独立集+判重
    UVA12186--树型DP
    HDU4171--bfs+树
    远程调用
    高并发业务
    wireshark
    将java程序打包成exe文件
    将博客搬至CSDN
    Mysql分区
    MogileFS
  • 原文地址:https://www.cnblogs.com/zhaow/p/8320737.html
Copyright © 2011-2022 走看看