Web Studyaspnet.blogspot.com Babyneed.blogspot.com

ASP.Net Web Developer Guide

Power By: eXTReMe Tracker Powered by Blogger  
 
 
 
 

 

 
Important Links
 
   
     
 
Sitemap
 
   
   
 
Reference
 
   

Wednesday, February 08, 2006

More About Namespaces in ASP.NET(Chapter 2)

Using Namespaces
To use a namespace in an ASP.NET page, you must use the Import directive. For example, the following statement placed at the top of your ASP.NET page enables you to use the objects in the System.Data namespace:
<%@ Import Namespace="System.Data" %>
'more code
That’s all you need to do. Behind the scenes, this instruction tells the CLR to reference this namespace when it compiles your ASP.NET application.The objects in the namespace then are dynamically loaded when they are called in your pages. Namespaces are a very powerful tool for developers. Because everything is grouped logically, you’ll be able to find and infer an object’s functionality much more easily than before. Often, just by knowing what namespace an object belongs to, you’ll be able to use it without having to refer to documentation. Now let’s take a look at the major namespaces available to ASP.NET.
Using the Microsoft
.VisualBasic Namespace
The Microsoft.VisualBasic namespace, which is exclusive to Microsoft’s Visual Basic, contains just one class, VBCodeProvider, and provides access to the Visual Basic.NET runtime, enabling you to interact with the compiler directly.
You won’t be using this namespace often in your dealings with ASP.NET, unless you need to change the way ASP.NET pages are compiled (which is a very rare occurrence), so we’ll move on. However, if you are interested in working more with VB.NET outside of ASP.NET, you should definitely explore this namespace further.
Understanding the Root
Namespace: System
The System namespace is the root namespace for the entire .NET Framework; thus, it contains all the basic and generic classes you’ll use in ASP.NET.These include the primitives (integers, strings, and so on), as well as all of the other namespaces in .NET. Since it is the root namespace, it is necessary to explore some of the major objects in this collection because they’ll be used throughout all your future applications.
Supplied Functionality
Most of the functionality you’ll be accessing from the System namespace involves the primitive data types, which the following sections will cover specifically. These include integral numbers, floating point numbers, date and time structures, string values, and Booleans, and additionally, the Object data type, which is generic.Table 2.1 describes the data types available.
Table 2.1 .NET Primitives
Primitive -- Category -- Description
Byte -- Integers -- 1-byte integral number (System.Int)
Short -- Integers -- 2-byte integral number (System.Int16)
Integer -- Integers -- 4-byte integral number (System.Int32)
Long -- Integers -- 8-byte integral number (System.Int64)
Single -- Floating-points -- 4-byte number with decimal point (System.Single)
Double -- Floating-points -- 8-byte number with decimal point (System.Double)
Decimal -- Floating-points -- 12-byte number with decimal point
Char -- Strings -- A single Unicode character (System.Char)
Date -- Dates -- Date and/or time value (System.DateTime)
Boolean -- Booleans -- True or false value (System.Boolean)

0 Comments:

Post a Comment

<< Home