public static void Main() { //Do your event wireup and any other thread work //Then, last thing: while(true) { //Do any periodic work you need executed on the main thread for some reason Thread.Sleep(10000); // 10 seconds or whatever } }
If you don't ever need the main thread to wake up to do something then you don't need a loop at all and you can put the thread to sleep forever. Your event threads will continue to process; this is just the main thread which you need to keep active so the whole program doesn't terminate.
public static void Main() { //Do your event wireup and any other thread work //Then, last thing: Thread.Sleep(Timeout.Infinite); }