Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am confused between namespace and library.
plz help
Posted

hi
The main class library in .NET is mscorlib.dll. This library contains a large number of core types that encapsulate a wide variety of common tasks. When a .NET application, there is automatic access to this library. We may view the class libraries provided by the .NET Framework by seeing the Global Assembly Cache (Go to C:\Windows\Assembly OR C:\Winnt\Assembly).

Class Library is another major entity of the .NET Framework. This library gives the program access to runtime environment. The class library consists of lots of prewritten code that all the applications created in .NET will use. The code for all the elements like forms, controls actually comes from the class library.

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.

Note that any language, that works on the .NET environment, targets the same set of namespaces & types provided by the .NET framework.

Also note that a single assembly like mscorlib.dll may contain any number of namespaces. In fact, namespaces may be nested (means a namespace within a namespace) to arrange classes in a hierarchical fashion.
 
Share this answer
 
Comments
Espen Harlinn 15-Oct-11 4:23am    
Good answer :)
A library is generally a file containing some functionality you can use in your application, e.g. dll- and jar-file.
The functionality/classes that the library exposes to you can be group into namespaces. The primary function of namespaces are to group functionality/classes logically and to avoid name clashes.
 
Share this answer
 
Comments
Espen Harlinn 15-Oct-11 4:23am    
Good answer :)
Simon Bang Terkildsen 15-Oct-11 14:02pm    
Thank you, Espen
They aren't really comparable terms!

A Namespace is a grouping together of related classes, which can apply restrictions as to what can be accessed within the namespace. It is
an abstract (or logical) container or environment - it does not have to be contained in a single file.

A Library is a collection of resources (which may be constants, methods, classes, images, or other information), which may contain zero, one or more namespaces. Normally, a Library is contained in a single file, although it may reference items in other library files.

[edit]Missed out the word "collection" from the Library paragraph - OriginalGriff[/edit]
 
Share this answer
 
v2
Comments
Espen Harlinn 15-Oct-11 4:23am    
Good answer :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900