.NET Namespaces

T

Techno Learner

The .NET namespace organization confuses me. I opened a new VB.NET
Windows Application and headed for the object browser. It had things
such as:

(1) mscorlib
(2) Microsoft.VisualBasic
(3) System
(4) System.Data
(5) System.Drawing
(6) System.Windows.Forms
(7) System.Xml
(8) WindowsApplication1

While I know the entries (2) through (7) are .NET namespaces, what is
the first entry mscorlib (I understand it is a deformation of
Microsoft Core Library but what exactly is it - a namespace)?

Further, I opened the mscorlib node in the treeview to see other
namespaces, some of which are:

(1) Microsoft
(2) Microsoft.Win32
(3) System

Opening the node System from within the mscorlib node showed me the
classes within the System namespace.

However, opening the System node that is a sibling (and not the child)
to the mscorlib class does not show the contained classes.

Why do they have the same namespace, System, twice - once as a child
to mscorlib and once as a sibling?

And when System.Data is a reference to the Data namespace contained
within the System namespace, would not setting a reference to just the
System namespace take care of all contained namespaces including
System.Data? Why do they have to seperately declare:

-System
-System.Data
-System.Drawing
 
H

Herfried K. Wagner [MVP]

* (e-mail address removed) (Techno Learner) scripsit:
The .NET namespace organization confuses me. I opened a new VB.NET
Windows Application and headed for the object browser. It had things
such as:

(1) mscorlib
(2) Microsoft.VisualBasic
(3) System
(4) System.Data
(5) System.Drawing
(6) System.Windows.Forms
(7) System.Xml
(8) WindowsApplication1

While I know the entries (2) through (7) are .NET namespaces, what is
the first entry mscorlib (I understand it is a deformation of
Microsoft Core Library but what exactly is it - a namespace)?

No, that are /not/ namespaces, but assembly names. Namespaces are
marked with a "{}" icon in the object browser. The namespaces contained
in an assembly are shown when opening the assembly's branch in object
browser.
Further, I opened the mscorlib node in the treeview to see other
namespaces, some of which are:

(1) Microsoft
(2) Microsoft.Win32
(3) System

Opening the node System from within the mscorlib node showed me the
classes within the System namespace.

However, opening the System node that is a sibling (and not the child)
to the mscorlib class does not show the contained classes.

That's another assembly.
 
T

Techno Learner

Thanks for the reply. That settles it. They're assemblies and not
namespaces. Eureka!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top