How to Kill Thread in C#?

佐手、 提交于 2019-12-01 11:37:11
jb_

Maybe you want to use Background-Threads instead of Foreground-Threads. Your application start with at least one Foreground-Thread (main process thread). If you create new Threads using the Thread-class directly (e. g. new Thread(...)), this will be an foreground thread.

An AppDomain is not unloaded when at least one foreground thread is still running. To avoid this behavior you can create a background thread. Typically you use background threads from the ThreadPool-class, or by setting the IsBackground-Property at the thread object directly.

edit: An short explanation at the MSDN.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!