Aliasing Namespace Names : Namespace Alias : Language Basics C# Examples


C# Examples » Language Basics » Namespace Alias »

 

Aliasing Namespace Names









    
using  N1  =  Namespace1;
using  N2  =  Namespace2;
      
namespace  Namespace1
{
        class  TestClass
        {
                public  TestClass()
                {
                        System.Console.WriteLine("Hello  from  Namespace1.TestClass!");
                }
        }
}
      
namespace  Namespace2
{
        class  TestClass
        {
                public  TestClass()
                {
                        System.Console.WriteLine("Hello  from  Namespace2.TestClass!");
                }
        }
}
      
class  MainClass
{
        public  static  void  Main()
        {
                N1.TestClass  Object1  =  new  N1.TestClass();
                N2.TestClass  Object2  =  new  N2.TestClass();
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Language Basics
» Namespace Alias