Using a Background threads Foreground thread : You can use foreground threads to keep the application alive. When non of foreground threads are running, CLR (common language runtime) will shut down your application. Background threads are then terminated.
Software Solution Architect, Tech Speaker, Former MSP & MSA