I am about to develop a console application that will be required to continually run and carry out work at specific times.
My question is what is are best methods or
You can add a reference to System.Windows.Forms
and call System.Windows.Forms.Application.Run()
to begin a standard application message loop. Ctrl-C will terminate the app.
Another option is to use Console.ReadKey()
to pause the app. Like Console.WriteLine("Press [ANY] key to quit..."); Console.ReadKey();
That's what I use in my console apps when they're just sitting there waiting for events to occur. In either case the app will continue to run and catch triggered events (like from a timer, WCF, FileWatcher, etc).