What is Namespace in .NET ? RRS feed

  • Question

  • What is the Namespace in .NET framework ? What is the use of it ?
    Friday, September 7, 2007 12:07 PM

All replies

  • HI Aleem,


    Consider a scenario. There are 2 classes both with the same name called mouse. One class refers to the animal mouse and the other refers to the computer mouse. So when you are calling mouse, how do you know, which to call. To avoid this conflict, we logically group simialr classes together to form containers called namespaces. In java, the equivalent of namespaces is packages.



    Friday, September 7, 2007 1:49 PM
  • a namespace is an abstract container providing context for the items (names, or technical terms, or words) it holds and allows disambiguation of items having the same name (residing in different namespaces).

    For many programming languages, a namespace is a context for identifiers. In an operating system, an example of namespace is a directory. It contains items which must have unique names. In the Java programming language, items that appear in namespaces have a short (local) name and unique long "qualified" names for use outside the name space. Also, some languages (such as C) combine namespace and names in a process called name mangling in order to eradicate ambiguity.
    Monday, September 10, 2007 3:27 AM
  • Namespaces are a way of organizing vast number of classes,structures,enumerations,delegates and interfaces that .NET Framework class library provides.Namespaces are hierarchially structured index into a class library, which is available to all of .NET languages.The namespaces, or object references are typically organized by function.


    A namespace is a combination of naming convention and an assembly, which organizes collections of objects and prevent ambiguity in object references.

    Friday, September 14, 2007 11:34 AM
  • Have a look at http://msdn2.microsoft.com/en-us/library/k50ex0x9

    Try to find anything in that namespace...

    In the top of the help file it even devides the namespace into 7 categories, so something tells me that the namespace should be subdevided.

    Personally I think that including/importing namespaces is a bad thing. I always write the whole name of a class, sure it's a little longer to write, but there are no doubt about which class that is actually used (eg both System.Windows.Forms and System.Web.UI.WebControls has a Class called Label).

    The advantage of not using include/import is that you learn where the class is placed in the namespace hierachy.
    Friday, September 14, 2007 8:10 PM
  • hi simply header file we calling namespace in .net k...


    Monday, September 24, 2007 3:18 PM