Steadhaven
Steadhaven
Explore posts from servers
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
then I won't have to worry, all of my code so far is just using main method returning void
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
Yeah ok
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
hm main method seem tougher than I thought to learn. I am just used to one main method in Java (perhaps its same there, but I am ignorant of it)
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
wow
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
lol
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
lol
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
True, this thing messed with me also that in C# we can have main method with int or void
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
thanks
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
yea true
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
ok thanks
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
ohhh sorry, one last quesiton. Is the TLS file always included in the Namespace and/or solution that I am writing in?
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
:)
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
makes sense
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
Thanks
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
now I get it. So ONE file with TLS at MOST, and it is not recommended to include extra things like classes etc in that file
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
Aaah
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
Ah makes sense
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
Right, so I can but it is not recommended. If I have a Main method explictly declared somewhere (not Program.cs), can I then have multiple Top Level Statement files?
52 replies
CC#
Created by Steadhaven on 3/4/2024 in #help
No 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
CC#
Created by Steadhaven on 3/4/2024 in #help
No Main and class confusion in newer C# versions
They in fact shouldnt even be in Program.cs
Still, 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 name
So 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