开发者

Release resources when stop debugging

I use Visual Studio 2005 & C#. In my FormClosing event I release some resources, that m开发者_高级运维y application uses. But when I debug it and decide to stop (Stop debugging), than FormClosing event doesn't fire and my resources aren't properly released.

How can I avoid this?


If you by "resources" mean things like open handles and allocated memory, you shouldn't worry. The OS will release this as the process terminates.

If you mean things like temporary files, registry keys, or other things that are committed to disk that you want to clean up after yourself, I'm afraid you won't be able to catch that when terminating the program, and will have to clean it up manually or on next start. To my knowledge, at least. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜