Hey, I am relatively new to C#, and realize that with the advent of namespaces, .h files and the like are no longer needed. But how can I code in multiple files? (is this even in the framework).
Since everything is now in classes, I dont like having 1 huge file with miles and miles of code in it. So I am writing most of my classes in a namespace in a seperate file, then would like to have import them into my file containing "main." How do i do this? I figure if i just typed
that VS.Net would not know where to find it, so I guess where do I go after I have coded my own namespace?
Also, if anyone can point me in the right direction of how to go about using multiple threads of execution inside c#, i would appreciate it. I have previously only done execution with a single thread, but my current project needs multiple threads to accomodate different sensors and waiting devices, and I don't even know where to begin with it. Thanks
For threading, look into System.Threading, the class would be System.Threading.Thread. There should be a lot of tutorials out there, it's a bit much to explain in one or two sentences.
You can have multiple source files in one project. Those sources do not need to be included like in C++ to be known. Every source file knows every other source file while compiling.
Say you write a class in file a that is called ClassA in namespace NamespaceA. To use it in file B, all you have to do is either #using NamespaceA and instanciate a ClassA or using the full path and instantiating NamespaceA.ClassA.
In Visual Studio.NET this is automatic, if you use csc the commandline compiler, look into it's options how to compile multiple source files. I think a good measure is one file per class.
so just as long as I add the file to the project, it is good to go?
Kinda forgot about adding files to the project/solution, so that may have been my missing link. Once it is in the project, it is good to go.
Will mess around with threading? Is it hard to learn/grasp? Is it that much of a stretch from normal single-execution programming?