public static void Main()
 {
     Action<string> action = a =>
     {
         Console.WriteLine($"Print row - {a}");
     };
     var asyncTimer = new AsyncTimer(action, 10, 1000);
     asyncTimer.Run();
 }
示例#2
0
        private static void Main(string[] args)
        {
            
            var timer = new AsyncTimer(3000, 3, () => Console.WriteLine("Timer elapsed!"));
            var secondTimer = new AsyncTimer(1000, 10, () => Console.WriteLine("Second timer elapsed!"));

            timer.Start();
            secondTimer.Start();

            //the program will exit after a key is pressed
            Console.ReadKey();
        }