Search

C# Namespaces

In C# the namespace keyword is used to organise related code. The nearest real world example would be like chapters in a book.
Each C# project has a default namespace and is usually based on the project name. The using keyword can be used as a key to include sections of code.

namespace MyProgram.Services
{
   public class SomeService
    {
        public static void SomeMethod()
        {

        }
    }
}
using MyProgram.Services;

namespace Myprogram
{
    class Program
    {
        static void Main(string[] args)
        {
            SomeService.SomeMethod();
        }
    }
}

 

Further reading Namespaces