Steadhaven
Explore posts from serversNo Main and class confusion in newer C# versions
Aha, so if I make a class (or similar things) then it auto assumes that this should not be included in the Main Method. Its smart enough to differentiate between Top Level Statements, and things like declaring classes which are not a Top Level Statement
52 replies
No Main and class confusion in newer C# versions
They in fact shouldnt even be in Program.csStill, it seems like
Program.cs
can't have classes (even if one shouldn't have it anyhow), since it seems to wrap everything in an implicit "Main" method
Top Level Statements work with any file nameSo if I have multiple files without an entry method (Main), as well as all of them being Top Level Statements, then I will get errors and it won't work? E.g. only one file is allowed to use Top Level Statements, if I didn't explcitly write a Main method myself somewhere?
52 replies