The Main method is the entry point of a C# console application or windows application. When the application is started, the Main method is the first method that is invoked. This Main() method is present in every executable application. Executable means any Console application, Windows desktop application or Windows service application.
There can only be one entry point in a C# program. If you have more than one class that has a Main method, you must compile your program with the /main compiler option to specify which Main method to use as the entry point.
So,
- The Main method is the entry point of an .exe program; it is where the program control starts and ends.
- Main is declared inside a class or struct.
- Main must be static. The enclosing class or struct is not required to be static.
- Main can either have a void or int return type.
- The Main method can be declared with or without a string[] parameter that contains command-line arguments.
Example:
• It can return void, like,
OR- static void Main()
- {
- //...
- }
• It can also return an integer, like- static void Main(string[] args)
- {
- //...
- }
OR- static int Main()
- {
- //...
- return 0;
- }
- static int Main(string[] args)
- {
- //...
- return 0;
- }
Main method define as Static
Static members are scoped to the class level (rather than the object level) and can thus be invoked without the need to first create a new class instance. A main method is static because it is available to run when your program starts and as it is the entry point of the program it runs without creating an instance of the class.
FAQ related to this article

jubula samalPosted May 24, 2019, 7:04 AM
Nice one. Keep it up.