I know C# supports namespace nestings, as does C++, which both allow code that looks like this...
namespace A {
namespace B {
...
}
}
Coming from a C++ background and diving into the C# world I've been meditating upon what appears as a hierarchical nesting of components via all the using directives that must be issued to exploit .NET, eg
using System.Collections;
using System.Collections.Generic;
I'm sure Microsoft intended and designed these libraries to be logically hierarchically organized, but without the aid of seeing the source I cannot verify if System.Collections.Generic has Generic as a nested namespace of Collections, but I assume it is, and that it was accomplished with namespace nestings like seen with A and B. Now once I start cooking up things in my own source and declaring code that looks like this
namespace C.D {
...
}
what exactly am I achieving here with respect to a hierarchy? Am I introducing to the code a singular namespace identifier "C.D" where the '.' is simply a friendly means of suggesting a hierarchy that may or may not exist depending upon the code structure or am I implicitly declaring two namespaces "C" and "D" with D nested within C? I've come across this question while cooking up a DevelopmentApplications namespace to our C# codebase that is meant to strictly contain all development tools used to augment our software to aid in its development. In those tools I've never declared a standalone enclosing namespace DevelopmentApplications (which is something I would HAVE to do in C++)...
namespace DevelopmentApplications
{
...
}
...but instead always create applications that go like
namespace DevelopmentApplications.MyDevelopmentApp
{
...
}
I know this area is a cause of confusion for some because of the following question where the author is struggling to understand the relationship between Foo.Bar.Baz and Foo.Bar. There's also an inverse question of a C# developer entering C++ land that gives some insight into this issue.
I suppose another way to state the question is that in C++ using the '::' operator to fully qualify a type I know guarantees that the code that type was declared in is nested deep in some namespace hierarchy. But in C# using the '.' operator to fully qualify some type must that type also exist in some deeply nested namespace hierarchy? I'm assuming here that C#'s use of a namespace like A.B.C does not necessarily require a hierarchical relationship between A B and C or that A B or C even exist as individual namespaces.
If someone can find or knows the relevant language specification regarding this syntax I'd love to read it.