C#计算程序的运行时间
/// <summary>
/// 计算程序的运行时间
/// </summary>
class StopWatch
{
private int mintStart;
public void start()
{
mintStart = Environment.TickCount;
}
public long elapsed()
{
return Environment.TickCount - mintStart;
}
}
在程序的开始和结尾处分别加上 StopWatch sw = new StopWatch(); sw.start(); 和 sw.elapsed();
sw.elapsed();的返回值就是程序的运行时间。
quote from: http://www.cnblogs.com/lbsx/archive/2010/05/12/1733966.html
Life is so beautiful

浙公网安备 33010602011771号