Using the alias keyword to refer to a nested namespace. : Namespace Alias : Language Basics C# Examples


C# Examples » Language Basics » Namespace Alias »

 

Using the alias keyword to refer to a nested namespace.









    
using  CmpDb  =  Company.InternalClasses.Database.Table;

namespace  Company.InternalClasses  {
        public  class  DBInterface  {
                public  static  void  Open()  {
                        System.Console.WriteLine("Opening  database");
                }
        }
        //  Define  a  nested  namespace  within  InternalClasses
        namespace  Database  {
                public  class  Table  {
                        public  static  void  Open(string  tblName)  {
                                System.Console.WriteLine("Opening  table  {0}",  tblName);
                        }
                }
        }
}

public  class  MainClass  {
        public  static  void  Main()  {
                CmpDb.Open("fred");
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Language Basics
» Namespace Alias