Home > DeveloperSection > Interviews > What is the name_space and nested Name_Space in C#?

Posted on    September-20-2016 5:48 AM

 C# C#  Nested 
Ratings:
 1 Answer(s)
  60  View(s)
Rate this:

Abhishek Srivasatava
Abhishek Srivasatava

Total Post:70

Points:350
Posted on    September-20-2016 5:48 AM

Namespaces

As the name suggests, name-space is designed to differentiate the one set of names from another. With the help of namespace we can organize our program by making a group of classes, delegates, interfaces, enumerations or structures.

Example : 

namespace MindStick
{
          public class demo
          {
                   public int demo1()
                   {
                   return 1;
                   }
          }                
}

Nested name_space

Below is the example to represent Nested Namespace

namespace Name_Demo
{
          class Program
          {
                   public int demo1()
                   {
                             return 1;
                   }
 
          }
          namespace n3
           {
                   using Name_Demo;
                   class b:Program
                   {
                                      static void Main(string[] args)
                                       {
 
                                       }  
 
                   }
           }
}

For more details click here: NamespaceNamespace and Class 



Modified On Sep-20-2016 05:48:52 AM

Don't want to miss updates? Please click the below button!

Follow MindStick