Reputation: 714
I have a program consisting of three classes. When I put the classes in the same file I can compile and run the code just fine. When I put each class in a separate file I get error CS0246 "The type or namespace could not be found" when I try to make objects of the two non-main method classes. I am not using namespaces, and the files are in the same folder.
I am not using Visual Studio. I compile the code in the command line. (Windows 7).
Upvotes: 0
Views: 66
Reputation: 5283
If you are separating the classes into different files you will need to 'import' the classes with using statements (typically if they have a namespace).
Try implementing using statements with just the class names, else I would highly recommend using namespaces (the same namespace is preferable in this scenario) in conjunction with using statements
Upvotes: 1