static is the key word is indicate in .net that, it can not be changed.while main is key word to indicate the main portion of application from where application is started. so the main entry point of application is fixed can not be changed as definition. but we can change its implements.so this is static.
static function do no require object to execute all the objects of classes are creating inside the main function
Static give the memory compile time.
For calling (executing) Each and every function, we need object of their related class. the reason behind to make a main function static. it will free from object, means it will call automatically without object when program will run. for executing static function there is no need to object. it only accessed by its class name. so main function is defined static. because main function is the entry point of executing program.
static is used to preserve memory at compilation time.so,that main function will be stored in memory any will be executed.
Every C# program of main is Entry Point of the execute the code.we know that static keyword is single copy in to memory.static keyword are without instanse.so it is use of static keyword in main function.
The static keyword indicates that it is single copy in to memory As main is entry point to execute the code so is is static and it doest require any object calling
as main function is entry point in execution and static keyword need not require any object for calling main function, so program starts directly from 'static main' in class
Main is the entry point for an application and to access the entry point from any where in an application that's why main is static.
C# Corner. All contents are copyright of their authors.