views:

181

answers:

4

Can an assemble have multiple namespaces or is composed of single namespace.

A: 

Assemblies can have multiple namespaces.

Tejs
How ? What is the logic behind that. What process goes on behind this.
Shantanu Gupta
@sha: An assembly is a different grouping concept than a namespace. They have different purposes and are not linked.
Joey
@Johan: Could you please provide some refrence supporting your answer so that some gud knowledge can be obtained about their creation
Shantanu Gupta
For example, in C#, the System namespace, as well as the System.IO and a whole other set of namespaces are contained in the System.Core.dll file.http://www.danielmoth.com/Blog/systemcoredll.aspx
Tejs
+3  A: 
  • An assemblies is a collection of code - objects, methods, properties, and other resources.
  • A Namespace is a logical groupings of those things.

An assembly can contain multiple namespaces, because it can contain multiple logical groupings of objects and methods. Most assemblies I've seen are a single namespace, just for clarity, but there's no reason a single assembly couldn't contain a dozen different namespaces.

rwmnau
A: 

Please see the msdn article Understanding and Using Assemblies and Namespaces in .net, that should clear up what does assembly mean and what does namespace mean.

Ando
+1  A: 

The hierarchy is: Assemblies contain Resources and Modules.

Modules contain Fields,Methods, and Types.

Types may be qualified by any arbitrary namespace, provided that it doesn't conflict with another existing Type.

Assemblies can short circuit past the Module level directly to all Types contained in all Modules in the assembly (via GetType() or GetTypes()).

plinth