如何退出一个程序,退出code:C#程序、code

由网友(时光是记忆的橡皮擦)分享简介:如何退出,退出code在C#程序?在java中这将是System.exit(int code); How to exit a program with an exit code in C#?In java it would be System.exit(int code);推荐答案或者:声明你的主函数返回...

如何退出,退出code在C#程序? 在java中这将是System.exit(int code);

How to exit a program with an exit code in C#? In java it would be System.exit(int code);

推荐答案

或者:

声明你的函数返回 INT ,并从它返回一个值,或 呼叫Environment.Exit(int) Declare your Main function as returning int, and return a value from it, or Call Environment.Exit(int)

返回从的值比退出过程中的方法的中间更好一点,但是这是presumably适用于Java的同样的忠告,C或C ++。

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++.

阅读全文

相关推荐

最新文章