开发者

How can I execute a specific chunk of code when my application crashes?

开发者_开发百科

Is there a way that I can execute a specific chunk of code when my application crashes? (i.e. If my application crashes, I would like to safely close some streams)


You can use AppDomain.UnhandledException event.


Well. You should do it in a try-catch-finally block then.

Final block is what happens last when you catch an exception. Example

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜