Username: Save?
Password:
Home Forum Links Search Login Register*
    News: Welcome to the TechnoWorldInc! Community!
Recent Updates
[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[February 14, 2024, 02:00:39 PM]
Subscriptions
Get Latest Tech Updates For Free!
Resources
   Travelikers
   Funistan
   PrettyGalz
   Techlap
   FreeThemes
   Videsta
   Glamistan
   BachatMela
   GlamGalz
   Techzug
   Vidsage
   Funzug
   WorldHostInc
   Funfani
   FilmyMama
   Uploaded.Tech
   MegaPixelShop
   Netens
   Funotic
   FreeJobsInc
   FilesPark
Participate in the fastest growing Technical Encyclopedia! This website is 100% Free. Please register or login using the login box above if you have already registered. You will need to be logged in to reply, make new topics and to access all the areas. Registration is free! Click Here To Register.
+ Techno World Inc - The Best Technical Encyclopedia Online! » Forum » THE TECHNO CLUB [ TECHNOWORLDINC.COM ] » Programming Zone » ASP .NET
 Namespaces in .NET
Pages: [1]   Go Down
  Print  
Author Topic: Namespaces in .NET  (Read 1249 times)
Taruna
Elite Member
*****



Karma: 13
Offline Offline

Posts: 845

Hi ALL


View Profile
Namespaces in .NET
« Posted: January 03, 2007, 01:39:59 PM »


A Namespace is a group of related classes. It is a good practice to group related classes into a namespace when you create a class library.

The main advantage of using namespaces is, to avoid conflicts when you have multiple classes with the same name. For example, .NET comes with a class called Form . Suppose you also write another class called Form in your application and if you refer to the class Form , how does the compiler know which Form you are refering to ?

Here is the importance of namespace . You can refer to the .NET Form using the fully qualified name, including the namespace like this :

System.Windows.Forms.Form

And you can refer to your own Form like this :

MyApplication.Form, where MyApplication is your namespace.

So, namespaces allow you to avoid name conflicts!

All classes in .NET class library are grouped into namespaces. You can use all the classes using the fully qualified name, including the namespace also along with the class name.
? System.Windows.Forms.FormSystem.String
? System.Double

If you want to declare a Button object, you must do the following :

System.Windows.Forms.Button myButton;

It is not mandatory to use the namespace also along with the name. You may use the using directive on top of the class and safely avoid the need to write the fully qualified name everytime when you refer to a class.

using System.Windows.Forms.Button;

If you have the above line of code on top of the class file, you don t need to type the namespace name System.Windows.Forms with all the classes in this namespace. You can simply use class name directly as shown below:

Button myButton;

.NET Namespaces

Here is a list of some of the namespaces in .NET class library.
? System
? System.Xml
? System.Data
? System.Data.OleDb
? System.Data.SqlClient

Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Copyright © 2006-2023 TechnoWorldInc.com. All Rights Reserved. Privacy Policy | Disclaimer
Page created in 0.182 seconds with 25 queries.