In both C and C++ the main function is of type int and at the end of the main method it returns 0. If the program returns 0 I know that the program was successful. But in c# the main is of type void by default (I guess you could change it to an int and return 0 aswell) so how can I know that the program was successful in this case? Do I have to debug or do some debug writelines to really clarify that the program was successfull in this case where the main method is void?
Asked
Active
Viewed 105 times
1
-
Know that your program was successful from where? – Haytam Jul 04 '18 at 23:13
-
3[The `Environment.Exit` method takes one parameter, which becomes the process exit code.](https://msdn.microsoft.com/en-us/library/system.environment.exit.aspx) – Ben Voigt Jul 04 '18 at 23:25
-
More discussion on Environment.Exit .. https://stackoverflow.com/questions/155610/how-do-i-specify-the-exit-code-of-a-console-application-in-net – Sql Surfer Jul 05 '18 at 01:11