你能简单解释一下这里的区别吗?我刚注意到,当我使用End时,我的整个应用程序立即关闭。什么是Application.Exit然后做什么和有什么区别?
答案 0 :(得分:2)
The End statement calls the Exit method of the Environment class in the
System namespace. Exit requires that you have UnmanagedCode permission. If you
do not, a SecurityException error occurs.
实际上,End
会调用Environment.Exit
,这会立即终止该程序。然而,Application.Exit
在关闭之前处理待处理的消息。
Informs all message pumps that they must terminate, and then closes all
application windows after the messages have been processed.