Friday, April 30, 2010

What is the difference between an Assembly and a Namespace?

2 comments:

Unknown said...

Assembly has a .exe, .dll in it. It also has Matadata and Manifest in it.
Namespace is a way of providing containers for application code, such that code and its contents may be uniquely identified.

Jasmine said...

Namespace :-
- It is a Collection of names wherein each name is Unique.
- They form the logical boundary for a Group of classes.
- Namespace is a grouping of related types contained in an assembly. For example, the System.Drawing namespace consists of classes, methods that are grouped together to achieve similar tasks.
- Namespaces may be nested (means a namespace within a namespace) to arrange classes in a hierarchical fashion.
- It is a group of managed types (classes, enums, structs, etc).
- One namespace can contain types from different assemblies.

Assembly:-
- An assembly is the primary building block of a .NET Framework application.
- It is an Output Unit.
- It is a unit of Deployment & a unit of versioning.
- Assemblies contain MSIL code.
- Assemblies are Self-Describing.They are managed dll or exe and have metadata and manifest
- It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files).
- All managed types and resources are marked either as accessible only within their implementation unit, or by code outside that unit.
- One assembly can contain several namespaces.

The name of the namespace is not necessarily the name of the assembly.