Name Clashes Within Namespaces

The “construct” on which the C# compiler operates when turning code into an assembly is called a compilation unit, which in practice maps to a code file. All of those units are processed together, almost as if it were one large file containing all the declarations made in the code.

Multiple occurrences of the same namespace are just fine. In more official terms, the language considers namespaces open-ended. Other compilation units processed by the compiler are free to add more declarations to a namespace:

// File1.csnamespace Contoso.CashFlow.Client{    class A { ... }}// File2.csnamespace Contoso.CashFlow.Client{    class B { ... }}

When multiple types with the same name are declared ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.