. , ? System.Timers. :
using System; // . using System.Timers; public class MyTimer { static int n=0; //. public static void Main() { System.Timers.Timer tmr = new System.Timers.Timer(); tmr.Elapsed+=new ElapsedEventHandler(OnTimedEvent); tmr.Interval=1000; // 1 . tmr.Enabled=true; // . while(n!=4); // 4 . } // Elapsed . public static void OnTimedEvent(object source, ElapsedEventArgs e) { // . Console.WriteLine("Hello World!"); // . n++; } }
Hello World 4 1 , .