It is clear that there is no such thing as a “namespace” from the point of view of a base system such as the CLR. Rather, it is simply an agreement that we say that a type containing periods in its name is a "member of the namespace". Logically, there is no difference between the legal code:
namespace N { class C {} }
and psuedo-code:
class NC {}
C # makes you pretend that this nice fantasy is real, but it's just a fiction - from the point of view of a CLR system, of course. From the point of view of the C # compiler, of course, namespaces are "real." They just don't match anything in the metadata except for the part of the type name.
In short: if you create an assembly with an "empty" namespace, then the "namespace" does not exist at all in the compiled binary. A “namespace” occurs only when there is a type in the library that has periods in its name.
Now, why do you care that the "empty" namespace has some presence in binary form, I have no idea.
I assume previous versions of C # demonstrate behavior that does not require this dummy class
Nope. Each version of C # with 1.0 throws out empty namespaces.
Eric Lippert Mar 05 '12 at 22:22 2012-03-05 22:22
source share