0

hi everybody,

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

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by BlackSun
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.