Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的应用程序中,我从自定义用户控件启动了一个工作线程。当控件被释放时,我中止了线程。问题是当计算机进入睡眠状态并且用户关闭应用程序时,我的控件不再被释放。
如果我在我的应用程序中启动一个线程,如何在应用程序关闭时强制它停止?
当控件被释放时,我中止了线程。
馊主意。中止线程会(并且经常会)破坏数据结构等内存。
您需要设置Thread.IsBackground = true.
Thread.IsBackground = true
在浏览 SO 时,我发现以下关于插入尚不存在的记录的“最佳”方法的问题/讨论。令我印象深刻的陈述之一是 [Remu