Define Namespace In C# Language

Introduction

Namespace is use for providing away to keep one set of names separate from another. In other word namespace  structure all the project into the same modules and to make the differ classes with same name. A namespace  is a way to provide separation  of selected class in a hole program.

Example

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace one

{

    class name_one

    {

        public void func()

        {

            Console.WriteLine("Function Of first namespace\n");

        }

    }

}

namespace two

{

    class name_two

    {

        public void func()

        {

            Console.WriteLine("Function Of second namespace\n");

        }

    }

}

class check

{

    static void Main(string[] args)

    {

        one.name_one obj1 = new one.name_one();

        two.name_two obj2 = new two.name_two(); 

        obj1.func();

        obj2.func();

       

    }

} 


Output


output.jpg


Next Recommended Reading Types of Namespace in C#