hi everybody,

am new to C#, i want a simple description about using namespaces in C#. plz help me

namespace is logical grouping of related classes so that`s mean the namespace is container of classes organized as hierarchically . for example system namespace in .net framework so system contains alot of classes so u use it in ur programe
using System;
and when u create ur DLL it create ur namespace depends on ur name project as we see in this ex:

namespace test
{
    public class Class1
    {
    }
}

ur dll project has name "test" and it`s contains ur own class so when u finish ur dll so add it on ur project and u will use it
as
using test;
so u can use "class1"
class1 blah = new blah(); and so on....
here another ex:

using System;
namespace SomeNameSpace
{
    public class MyClass 
    {
        static void Main() 
        {
            Nested.NestedNameSpaceClass.SayHello();
        }
    }

    // a nested namespace
    namespace Nested   
    {
        public class NestedNameSpaceClass 
        {
            public static void SayHello() 
            {
                Console.WriteLine("Hello");
            }
        }
    }
}

sorry for my bad expression.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.