.NET Namespaces
Namespaces are collections of objects, with every Namescape containing different sets of objects grouped according to functionality. For example, the System.Data namespace contains all the classes you will need to interact with data sources. Without System.Data, it'd be impossible for ASP.NET to function hand-in-hand with ADO.NET. It contains methods you can use to connect to databases and a few methods you can use to handle XML files. However if you want ASP.NET to manipulate XML data, the System.XML Namespace would come in handy. System.Drawing, another namespace, contain classes you can use to manipulate images. There are so many Namespaces, it'd be impossible to describe them all in one tutorial, and it is important that you learn what a Namespace is.
Namespaces are contained in files called assemblies. These files have DLL extensions. The System Namespace is in System.DLL, but not all namespaces have DLLs matching their names. For example, System.Web.UI is in System.Web.DLL. However these DLL files are compiled into the Microsoft Intermediate Language (MSIL) which is understood by the Common Language Routine (CLR). Therefore they are different than normal DLLs. These files can be found in the directory where the .NET Framework was installed. With the dissambler Ildasm.exe, you can actually see the classes, functions, etc that these Namespaces contain.
Using Namespaces
There are two ways of importing a namespace into ASP.NET: implicitely and explicetely. If you want to do explicetely, you have to use the command Import, like this:
<% @Import Namespace=”System.XML” %>
The CLR will include the Namespace when the ASP.NET application is compiled. Some namespaces are automatically imported into ASP.NET pages, so you don't need to use Import to make CLR include them. System, System.Collections, System.IO, System.Web, System.Web.UI, System.Web.UI.HTMLControls, and System.Web.UI.WebControls are the namespaces that will always be taken into account by the CLR. A namespace like System.Data, which you may need if you are working with databases, needs to be imported explicetely.
You don't have to use Import if you want to invoke a Namesace. In the above example, System.XML became a part of the script through import. However you can do something like this:
DIM Obj_Man as System.XML.XMLNamespaceManager = new System.XML.XMLNamespaceManager(nt)
Had to decided to use Import, the instructions would've looked like this instead:
DIM Obj_Man as XML.XMLNamespaceManager = new XMLNamespaceManager(nt)
Of course, you may already have noticed that invoking a Namespace without Import can make your ASP.NET scripts a little more complex.
The System Namespace
Contained in the file System.DLL, this Namespace is the root of the .NET Framework. It contains all the primitives: Byte, Short, Integer, Boolean, Date types and Arrays. It contains classes that can be used for data type conversion, mathematics, application environment management mathematics, and supervision of applications. It is impossible for an ASP.NET script to work without it.
System.Collections
The System Namespace also contains an object called the Array, which is too broad for this tutorial. An array can be like this:
Dim Array_Example() as Integer = {22, 46, 67}
In this case, the size of the Array is 3 because it contains three values. If you want to get access to the values, you need to start from 0. That being said, Array_Example(0) would have a value of 22 wherear Array_Example(2) would have a value of 67. The System.Collections Namespace has several Classes that allow you to manipulate Arrays. Classes like Comparer, which compares two objects for equivalence, and Hashtable which represents a collection of key/value pairs.
System.Data
Once upon a time, there was ADO 2.6. It contained three objects that allowed users to manipulate data: connection, command, and recordset. But ADO 2.6 had problems, and one of them was its inability to penetrate firewalls. ADO.NET has a multitude of objects that allow you to work with SQL and Ole-DB servers.
System.Data is the Namespace which contains the objects you need to access the services provided by ADO.NET. Objects like DataSet, DataRow, and DataReader can be used to store data in virtual memory. The Namespace System.Data has several Sub-Namespaces. System.Data.OleDB and System.Data.SQLClient are perhaps the most important. They contain objects like OleDbConnection, OleDbDataSet, SQLConnection, and SQLCommand which can allow you to manipulate data in databases and read these data into your webpages.
There are several Namespaces in the NET Framework. Think of a huge library with thousands of books. How hard would it be to find the book you want if they weren't arranged at all? Perhaps it'd take you years to locate the book you want. Namespaces make things easy for programmers by grouping objects into categories.
If you want to know more:
http://msdn2.microsoft.com/en-us/library/default.aspx (click on .NET Development and then Class Library.)
http://www.perfectxml.com/syngress/aspnet/Page1.asp
http://www.asp101.com/articles/jay/adodotnet/default.asp
http://authors.aspalliance.com/aspxtreme/sys/system.aspx



