Using the alias keyword to refer to a nested namespace. : Namespace Alias « Language Basics « C# / CSharp Tutorial






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");
    }
}








1.6.Namespace Alias
1.6.1.Use the global alias.
1.6.2.Aliasing Namespace Names
1.6.3.Aliasing Class Names
1.6.4.Using a Namespace Directive
1.6.5.Using the alias keyword to refer to a nested namespace.
1.6.6.Simple Aliases for namespace
1.6.7.Global Namespace Alias