I am planning to use the return code of the C# executable in one of my shell script. I have two options:
Returning a int value from the main method<
The difference lies when you need to handle the event on a parent application based on exit status of another application. Return is primarily used within an application, while exit is used to suddenly end an application. Here exit status can be used by another application to decide on its next steps.
A return is used when you are returning a value to another function from where the code is called. or to indicate the end of code execution on some event.
You can also see it like this:
1) A return ends a function, which could be main(); an exit is used to end the program.
2) Ending a program with a certain return value does cannot be interpreted implicitly by another application, but exit status can be used to decide on a code implementation.