error cs8802 vs code ide
how can I run c# code it says "Only one compilation unit can have top-level statements" what to do please help

9 Replies
Well, only one file may contain code outside of a class. You probably have multiple files like that?

here first i deleted program.cs i thought that might be a problem but it didnt fix my issue
What do
first.cs
and second.cs
contain?this basic code

you can only lay code out like that in one file (generally the Program.cs)
all other code needs to be in methods inside classes/structs
means should i write code in old format or what
e.g
ok thanks