| |
|
What is the difference between a Class Library and a Namespace?
Class Library is another major entity of the .NET Framework (the other being the CLR).
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. 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).
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 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.
Also note that any language, that works on the .NET environment, targets the same set of namespaces & types
provided by the .NET framework.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| |