简体   繁体   中英

C# Run Function when User Exits

Is there any way to call a function in C# when the user exists the application?

I'm using Visual C# 2008 Express edition.

Thanks.

It's a windows forms applications, isn't it? You can use this event:

System.Windows.Forms.Application.ApplicationExit += ...

I've never tried it so this may be a shot in the dark, but couldn't one override the default exit method and do something like protected override exit {myMethod(); base(e);} Though I'm assuming delegation does essentially the same thing in this case

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM