+ 2
Why we use static keyword in main method?
2 Antworten
+ 1
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. In other words, static functions exist before a class is instantiated so static is applied to the main entry point (Main method).
0
The Main method is the entry point of your C# program.
A static method is a method which can be called without creating an instance of the class. So in other words, the compiler can execute the Main method without the need to create an instance of the class containing the Main method.