This blog contains the programming tips, obscure logic, and unnoticed clues which generally come into our mind but we are unnoticed. This blog is targeted for experienced programmers. If you have any related contents, please help me, I will public in my blog

What is the difference between foreground and background thread?

• Foreground threads have the ability to prevent the current application from terminating. The CLR will not shut down an application (which is to say, unload the hosting AppDomain) until all foreground threads have ended.

• Background threads (sometimes called daemon threads) are viewed by the CLR as expendable paths of execution that can be ignored at any point in time (even if they are currently laboring over some unit of work). Thus, if all foreground threads have terminated, any and all background threads are automatically killed when the application domain unloads.