I sorta feel embarrassed because I am sure the answer to this is simple. Just to add some background, I am a full time java developer with a bachelors degree and 2 years of experience. I just started C# today using Visual Studio 2010 and Google to fill in the differences between C# and java.
So I had a console application that runs all good. All the code was in the main method, because I was trying to learn syntax and make sure things were working before I got too complicated.
I went to move all the code out of the main method and into its own class.
The main method and the class have the same namespace, but defined in separate files. One called Program.cs, the other called FileCache.cs.
FileCache.cs:
namespace SyncServer {
public class FileCache {
public FileCache() {
//...code and such
}
//...methods and such
}
}
Program.cs:
namespace SyncServer {
class Program {
static void Main(string[] args) {
FileCache fileCache = new FileCache(); //major jitterbugs;
}
}
}
The type or namespace name 'FileCache' could not be found (are you missing a using directive or an assembly reference?)
I get no other compile errors or warnings. Also, if I move the FileCache definition into Program.cs, it compiles fine. I was hoping to find a solution where I didn't have to put ever class in the same file. :)
Thanks in advance!