How to exit a program with an exit code in C#?
In java it would be System.exit(int code);
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Either:
- Declare your
Main
function as returningint
, and return a value from it, or - Call
Environment.Exit(int)
Returning a value from Main
is a little nicer than exiting the process in the middle of a method, but this is presumably the same advice that applies to Java, C or C++.