C# 测某段代码运行所需时间

这功能有时候很有用


using System.Diagnostics;


Stopwatch Watch = new Stopwatch();
            Watch.Start();
//要测试的代码
Watch.Stop();
long watchTime = Watch.ElapsedMilliseconds;//花费时间






你可能感兴趣的:(C#WIN控件)