时间间隔取法

1:
[DllImport("Kernel32.dll")]
 public static extern UInt32 GetTickCount();

private void int GetVal()
{
UInt32 Start = GetTickCount();               
{
                //doing.......
}
UInt32 End = GetTickCount();
return  (End - Start);
}

2:

 DateTime Start = DateTime.Now;

        //doing......
}
return DateTime.Now.Subtract(dt).Milliseconds.ToString();

原文地址:https://www.cnblogs.com/94cool/p/1699820.html