tags:

views:

221

answers:

5

Does everything in a single namespace compile into its own assembly?

+10  A: 

No.

You can have several namespaces in an assembly, and you can use the same namespace in different assemblies.

Guffa
E.g. System.dll and System.Core.dll both contain types in both the System and System.Collections.Generic namespaces (amongst many others).
Richard
+3  A: 

No, you can have multiple namespaces within an assembly. In VS terms, you can think of an assembly as a project. Each project within a solution, gets compiled into it's own assembly. Within an assembly though, you can have multiple namespaces.

BFree
A: 

If you're asking if each namespace results in a seperate assembly, then no. One assembly can contain multiple namespaces.

Aistina
A: 

Assemblies and namespaces have nothing to do with each other except that there's a generally used convention that the full names of classes in an assembly will match the assembly name (in some way).

It's strictly a naming convention - as Guffa said, assemblies can define classes for more than one namespace and the classes that exist in a namespace can come from more than one assembly.

Michael Burr
A: 

After 1 year : I have two projects in single solution. I want to access few class from project 1 into project 2. I have added reference of project 2 in project 1. I can see dll of project 2 has been copied into reference section of project 1, but then also I am not able use namespace I have used in project 2. can anyone suggest some solution to this problem? Please let me know if you need some more information about this problem.

Thanks !!!

Shekhar