cs0116 error

C# learner

Active member
Dec 22, 2022
Programming Experience
Receiving error description: "A namespace cannot directly contain members such as fields, methods or statements." If I try to fix that then I get message: "More than one entry point." Where can I start to find where the problem is?

namespace Family_Tree_Create_Files

void Main()
This may be due to confusion over top-level statements, or it may not. What type of project is this - Console, WinForms, etc - and what framework are you targeting? If it is a Console targeting .NET 6 or later, did you check the box to NOT use top-level statements when creating the project? If you don't know what that is, you almost certainly didn't. If you didn't, please show us the contents of the Program.cs file.
Top Bottom