C# C# Objects Inheritance Throwing Exceptions

Does the namespace of all classes have to be the same name as the exe file's name?

TreehouseDefense is the namespace of all the classes in the project. If I compile the Game class as mcs Game.cs it gives me an error Are you missing an assembly reference? Does this mean The exe files name and all namespaces have to be the same?

2 Answers

Steven Parker
Steven Parker
140,125 Points

There's no requirement that the namespace(s) correspond with the output file name. But if I recall correctly, this project has more than one input file, so compiling any one by itself would be likely to produce that error.

To facilitate a complete analysis and more specific answer you can make a snapshot of your workspace and post the link to it here.

Ihor Bodnarchuk
Ihor Bodnarchuk
2,010 Points

They can be different since you can call .exe file whatever (remember -out: <name_you_picked> ?). just make sure you compile all of them by running mcs *.cs like Steven said