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 AppDomain.ProcessExit doesn't seem to catch Ctrl-C or Ctrl-Break. Anyone knows anything about that?
You can check the ProcessExit
and DomainUnload
events of the AppDomain
class.
Maybe the answers to this may help you:
There's the Application.ApplicationExit event if you've a WinForms application. For WPF there's Application.Exit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With