✅ Only one compilation unit can have top-level statements
my program.cs suddenly started giving me this error, I use visual studio code btw and I am a beginner at c#
29 Replies
C# is project based, not file based.
You can only have "top level statements" in one file per project
Usually "Program.cs"
mkays
so what should i do
to fix this
delete the other 2 module.cs files>
that would work, but Im kinda guessing you want those use those files somehow?
deleting them would thus.. delete them :p
yeah
i have em all commented out btw
so those are just comments
also this just happened now
well thats why
else it was good before
if you emptied them out entirely, they count as top level statement files
o
so
ii should remove the comment outs?
that, or the files
I didn't think you could start class names with numbers?
(as a separate issue)
not classes, but files you can
well
deleting the files solved it
guess i gotta store code in txt files now
xd
nah. use something like Obsidian to keep notes and snippets
whats that
an application?
a notetaking application
i see
thanks a lot, i ll try that
its my personal favorite
damn
Or just Markdown files in a Github repo, which is what I do ¯\_(ツ)_/¯
might as well
thats what obsidian does :p
yal smart af
Well, that's what it can do
If you use the Git plugin and all
its a markdown editor, and your "storage" is just a folder that can be git-init:ed if you want
Alas, it's not supported on the mobile app
true, but how often do you write code on your phone?
yeah
never
that would be a headache
how do I close this
!solved
o
$close
Use the /close command to mark a forum thread as answered