atexit, exit delegate in c#

前端 未结 4 2058
无人共我
无人共我 2021-01-18 08:10

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#?

UPDATE: The

相关标签:
4条回答
  • 2021-01-18 08:49

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

    0 讨论(0)
  • 2021-01-18 08:56

    Maybe the answers to this may help you:

    • How do I trap ctrl-c in a C# console app
    0 讨论(0)
  • 2021-01-18 09:12

    There's the Application.ApplicationExit event if you've a WinForms application. For WPF there's Application.Exit.

    0 讨论(0)
  • 2021-01-18 09:12

    If you're running a WinForms app you can add a listener to the Application.ApplicationExit event

    0 讨论(0)
提交回复
热议问题