Smart    Lucky

Smart Lucky

  • NA
  • 555
  • 627.4k

Namespace

Mar 18 2011 2:37 AM
using System;
using NameSpaces1;
 using a = System.Console;

namespace NameSpaces1
{
    
    internal class NamespaceClass1
    {
        
        public void FirstNameSpaceFirstMethod()
        { 
            Console .WriteLine ("This is First Namespace first method");
        }
        public void FirstNameSpaceSecondMethod()
        {
            Console.WriteLine("This is First Namespace Second method");
        }

    }
    class NamespaceClass2
    {
        public void FirstNameSpaceSecondClassFirstMethod()
        {
            Console.WriteLine("This is First Namespace SecondClass first method");
        }
        public void FirstNameSpaceSecondMethod()
        {
            Console.WriteLine("This is First Namespace SecondClass Second method");
        }

    }
    
}
namespace Namespace2
{
    class NamespaceClass2
    { 
         public void SecondNameSpaceSecondMethod()
        { 
            Console .WriteLine ("This is Second Namespace Second method");
        }
    }
}
namespace Namespace3
{
    class NamespaceClass3
    {
        public void ThirdNameSpaceThirdMethod()
        { 
            Console .WriteLine ("This is Third Namespace Third method");
        }
    }
}


class Testng
{
    static void Main()
    {
       
        NamespaceClass1 n = new NamespaceClass1();
        n.FirstNameSpaceFirstMethod();
        Namespace2.NamespaceClass2 m = new Namespace2.NamespaceClass2();
        m.SecondNameSpaceSecondMethod();
        Console.ReadKey();
    }
}


This working wright but when i am using 

using NameSpaces1.NamespaceClass2;


means i want to use namespace1 just class2 but it is not working showing an error why.......? can any one help me....























Answers (4)