Visibility

Namespaces don’t have a notion of visibility. In C# terms, you could say namespaces are implicitly declared as public because they can’t be used to restrict visibility of the types defined within them. In other words, it’s up to the types (and members therein) to declare their visibility.

Figure 24.7 illustrates how namespaces are totally compiled away into longer type names, which is what the CLR sees. In other words, there’s no place in an assembly to put metadata (such as visibility) on a namespace declaration. What tools like ILDASM and .NET Reflector do is show types in their namespaces by analyzing the dot-separated pattern followed for their naming. The fact there’s no such thing as metadata associated with a namespace is reflected ...

Get C# 5.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.