Allowed Entry-Point Signatures

As we all know, invocation of programs in operating systems supports passing in command-line parameters. In addition, executables can provide an exit code upon termination, indicating the result of the invocation, with a zero value typically denoting a success state. To enable those scenarios, four different signatures for the Main method are permitted:

static void Main()static int Main()static void Main(string[] args)static int Main(string[] args)

Those are essentially the four combinations formed by the following:

Image Returning an integer-valued exit code or none at all

Accepting an array of command-line arguments ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.