Web Studyaspnet.blogspot.com Babyneed.blogspot.com

ASP.Net Web Developer Guide

Power By: eXTReMe Tracker Powered by Blogger  
 
 
 
 

 

 
Important Links
 
   
     
 
Sitemap
 
   
   
 
Reference
 
   

Tuesday, February 07, 2006

ASP.NET Namespaces (Chapter 2)

Introduction
Microsoft defines namespaces as “a logical naming scheme for grouping related types.”What that means to us is that all objects used in ASP.NET are grouped by type, making them easy to find and to use. Imagine the .NET namespaces as a file cabinet.You use file cabinets to group related things to make finding them easier, and to preserve your sanity. For example, you may place the deed to your house and your mortgage coupons in one folder, while college loan papers and stubs go in another. Namespaces represent exactly the same concept. Like objects are grouped together: an HTMLInputTextBox object is grouped in the same namespace as the HTMLAnchor object, because they both represent HTML-user interface controls displayed to the user. In subsequent sections we’ll be looking at all the major namespaces that ASP.NET will take advantage of.
System is the root of the namespaces.Within each namespace we can find anywhere from one to several other subnamespaces that provide programmers with the functionality needed to create and provide Web-based applications.
System.Web is a great example.Within its namespace it contains over 10 different sub-namespaces that fulfill many of the basic Web functions and then some. System.Data contains various database connectivity methods, such as communication with SQL databases and some limited Extensible Markup Language (XML) connectivity. For specialized XML connectivity we can use System.XML, which can provide everything from parsing to translating XML schemas.
Reviewing the Function of Namespaces
As mentioned in the introduction, namespaces are logical collections of objects. You’ll reference many namespaces and their objects throughout your ASP.NET development, so it’s helpful to dig a bit deeper into the technology. You should already have a grasp on the conceptual ideas behind namespaces— that they are containers for objects. However, how is this represented physically on your computer? A namespace is usually contained in a file called an assembly.These files look outwardly just like dynamically linked libraries (DLLs), and they even end in the .dll extension. If you are familiar with DLLs, then you’ll know that prior to .NET, they were used to supply additional functionality and objects for your applications.
In .NET, they do exactly the same thing, except that everything within the DLL file belongs to a specified namespace. The main difference between .NET and non-.NET DLLs is that .NET DLLs are not compiled into machine language. Rather, they are compiled into the Microsoft Intermediate Language (MSIL), which is understood by the Common Language Runtime (CLR).Therefore, the two types of DLLs are not interchangeable (although you can build wrappers around non-.NET DLLs to make them
compatible—see the .NET Framework Documentation under the tlbimp.exe tool).
Note that you can also create your own namespaces, or add to existing ones. See “Programming with Assemblies” in the .NET Framework Documentation for more information.

0 Comments:

Post a Comment

<< Home