The Main Method Flashcards
What is the Main method?
The entry point of a C# application.
Do libraries and services require the Main method?
No.
What happens when an application starts?
The Main method is invoked.
How many entry points can exist in a C# application?
One.
From what version of C# can you write statements at the top level of the C# file and have them executed as if they were inside the Main method?
C# 9.
Can the Main method be public?
No.
Can the Main method be declared as an instance method?
No.
What are the possible return values of the Main method?
void or int.
Starting from C# 7.1, what additional possible return types were added to the Main method?
Task and Task.
When specifying the Main method with return value Task or Task, what modifier is needed?
The async modifier.
Does the Main method receive arguments?
Yes, and it is optional to specify the parameter, it is an array of strings that represent the arguments passed to the executable.
When the Main method returns an int, what does this value mean?
The exit status of the program.