10.2 Application termination
Application termination returns control to the execution environment.
C# LANGUAGE SPECIFICATION
70
If the return type of the application.s entry point method is int, the value
returned serves as the
application’s termination status code. The purpose of this code is to
allow communication of success or
failure to the execution environment.
If the return type of the entry point method is void, reaching the right
brace (}) which terminates that
method, or executing a return statement that has no expression, results in
a termination status code of 0.
Prior to an application.s termination, destructors for all of its objects
that have not yet been garbage
collected are called, unless such cleanup has been suppressed (by a call to
the library method
GC.SuppressFinalize, for example).
Application termination returns control to the execution environment.
C# LANGUAGE SPECIFICATION
70
If the return type of the application.s entry point method is int, the value
returned serves as the
application’s termination status code. The purpose of this code is to
allow communication of success or
failure to the execution environment.
If the return type of the entry point method is void, reaching the right
brace (}) which terminates that
method, or executing a return statement that has no expression, results in
a termination status code of 0.
Prior to an application.s termination, destructors for all of its objects
that have not yet been garbage
collected are called, unless such cleanup has been suppressed (by a call to
the library method
GC.SuppressFinalize, for example).
博客介绍了C#应用程序终止的相关内容。应用程序终止会将控制权返回执行环境,若入口点方法返回类型为int,返回值作为终止状态码;若为void,到达方法右花括号或执行无表达式的return语句,状态码为0。终止前会调用未垃圾回收对象的析构函数。
3046

被折叠的 条评论
为什么被折叠?



