在C#中的atexit,出口代理 [英] atexit, exit delegate in c#

查看:102
本文介绍了在C#中的atexit,出口代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中有一个叫函数 atexit对在那里你可以注册功能该系统退出时应该运行。有没有在C#中的任何类似事件。

In c++ there is a function called atexit where you can register functions which should be run when the system exits. Are there any similar events in C#?

更新:
的AppDomain.ProcessExit似乎并没有赶上Ctrl-C键或Ctrl-中断。任何人都知道相关信息吗?

UPDATE: The AppDomain.ProcessExit doesn't seem to catch Ctrl-C or Ctrl-Break. Anyone knows anything about that?

推荐答案

您可以检查的 ProcessExit 和的 DomainUnload 上的 的AppDomain 类。

You can check the ProcessExit and DomainUnload events of the AppDomain class.

这篇关于在C#中的atexit,出口代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆