最近学习C#,有两个问题想请教大家:
1. 如何获取当前时间microsecond.
2. Application.DoEvents()太占资源了,而且反应也很慢,有没有别的函数或方法,实现如下功能:while(!b_stop_cycle_move){
//do something
Application.DoEvents();
}while循环的同时还可以点击界面的其他控件。多谢了!

解决方案 »

  1.   

    using System;class gettime
    {
       public static void Main()
       {
          DateTimeOffset offsetDate; 
          DateTime regularDate;      offsetDate = DateTimeOffset.Now;
          regularDate = offsetDate.DateTime;
          Console.WriteLine(offsetDate.ToString());
          Console.ReadLine();   } 
    }
      

  2.   

    DateTimeOffset 出来的时间是系统每15ms刷新出来的,所以会有机会有15ms延时,再者只能得到milisecond,不能得到microsecond。
      

  3.   

     string time = DateTime.Now.ToString();
      

  4.   

    DateTime.Now就是当前时间
    DateTime.Now 下面还有很多属性
      

  5.   

    多谢各位了,不知你们试过没有,DateTime.Now后面的属性真的没有microsecond