Console Application On Exit (Win 11)

Is there a way to properly run code on exiting console app to release resources or just block the Ctrl+C and Closing the window exiting?
3 Replies
ffmpeg -i me -f null -
this is a garbage collected language, this stuff is usually done for you; what are you specifically worried about
Angius
Angius7d ago
You could try PosixSignalRegistration.Create(PosixSignal.SIGINT, ctx => ...) Or SIGTERM That said, if there's anything that uses unmanaged resources, it should be IDisposable or IAsyncDisposable That way the resources get released automatically when they go out of scope And the end of the Main() method is one such scope
Unknown User
Unknown User6d ago
Message Not Public
Sign In & Join Server To View