Sunday, September 27, 2015

NAMESPACES



Namespaces are logical grouping of classes and other types in hierarchical structure.Namespaces are useful to avoid collision or ambiguity among the classes and type names.The Use of the namespace is to arrange a group of classes for a specific purpose. Namespaces are C# program elements designed to help you organize your programs. They also provide assistance in avoiding name clashes between two sets of code. 


Implementing Namespaces in your own code is a good habit because it is likely to save you from problems later when you want to reuse some of your code. For example, if you created a class named DbConnection, you would need to put it in your own namespace to ensure that there wasn't any confusion about when the System. DbConnection class should be used or when your class should be used. Generally, it would be a bad idea to create a class named DbConnection, but in many cases your classes will be named the same as classes in either the .NET Framework Class Library or a third party library and namespaces help you avoid the problems that identical class names would cause.


Namespaces don't correspond to file or directory names. If naming directories and files to correspond to namespaces helps you organize your code, then you may do so, but it is not required.

There are 124 Namespaces are in .NET version 1.1



There are 7 namespaces which are imported automatically by Visual Studio in ASP
  • System
  • System.Collections
  • System.IO
  • System.web
  • System.web.UI
  • System.web.UI.HTMLControls
  • System.web.UI.WebControls.
There are 3 Namespaces used for Data Access

  • System.Data
  • System.Data.OleDB
  • System.Data.SQLClient
There are 2 Namespaces to create a localized application
  • System.Globalization
  • System.Resources

There are 2 Namespaces used create threading in ASP
  • System.Threading.Thread
  • System.Threading





No comments:

Post a Comment