What is Namespace in C#, need of namespace or why use namespace

What is Namespace in C#, need of namespace or why use namespace:


Namespace in C#:


In C# Name space like a container of objects. They may contain union, structure, classes, delegate and interface. The main importance of namespace in Asp.net C# is for creating a hieratical organization of program. Basically System is a root namespace in asp.net C#.
In .net every programs is create with a default name space. This default namespace is called global name space. But program itself create any numbers of namespace, each of unique name.




To declare a namespace C# .net has a reserved keyword “namespace”. When we creating a new project in .net C# the one namespace is automatically adds in project.

How to create  namespace in .net C#:

Here we make a program for explain this “how to create and use a name space”.
Using System;

Namespace MyNamespaceText
{
Class nameSpacCSS
{
Public static void Main()
{
Console.WriteLine(“this is a new C# namespace………..”);
}
}
}



Comments