Hi there, I'm currently developing a .NET Windows Service and am curious about how references vs. namespaces work on a high level. I come from a C++ background and am only familiar with statements like #include <...> etc. Thanks for the clarification.
A reference is simply a way to tell the compiler to look in the referenced assembly for types when trying to resolve them.
Now, namespaces are not tied to assemblies. Namespaces are a logical construct while assemblies are a physical construct.
This is why you see classes in .NET from the System namespace in mscorlib.dll, System.dll, System.Core.dll, etc, etc.
So while you can have tremendous overlap between the two, you should avoid leaking your namespace across too many assemblies.
I take a assembly-per-namespace approach (the assembly only has types from one namespace, assuming it is specialized), but your approach may vary.
Generally though, keep the namespace bleed small (or none at all) and you will generally be fine.
For all intents and purposes references (e.g. using System.Text) are just like #includes, but rather than including a header file you are linking an assembly.
Namespaces are a really handy way to divide your code into semantically similar chunks; for example, all of the Xml type classes are in System.Xml.