A Timer that fires once at the specified time : Timer : Development C# Examples


C# Examples » Development » Timer »

 

A Timer that fires once at the specified time









    
using  System;
using  System.Threading;
using  System.Globalization;

class  MainClass
{
        public  static  void  Main(string[]  args)  
        {
                TimeSpan  waitTime  =  new  TimeSpan(1000);

                new  Timer(delegate(object  s)  {
                                                        Console.WriteLine("{0}  :  {1}",
                                                        DateTime.Now.ToString("HH:mm:ss.ffff"),  s);
                                                }
                                    ,  null,  waitTime,  new  TimeSpan(-1));
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Timer