What happens when you close the .NET console application?
Is a method like OnClosed(EventArgs e)
??
Update
Finished using the code from the following URL:
http://osdir.com/ml/windows.devel.dotnet.clr/2003-11/msg00214.html
source to share
Check out this article / post .
Basically, you are connecting to SetConsoleCtrlHandler and subscribing to events.
source to share
No, because there is no message pump on the closed event.
However, the AppDomain is unloaded as the process is demolished, and this will start AppDomain.DomainUnloaded . You can use this to capture the event when the program shuts down.
source to share
There is an event AppDomain.ProcessExit
that you can hook up an event handler to. Note that this is "time in a box"; by default, it allows execution for a maximum of 3 seconds, so you shouldn't be doing something for a long time there.
source to share