Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Namespaces In C#.");
            first_space.namespace_c1  fc = new first_space.namespace_c1();
            second_space.namespace_c1 sc = new second_space.namespace_c1();

            fc.func();
            sc.func();

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Use Namespaces In Our Code With Using  Directives...");
            //namespace içerisindeki classın objectini doğrudan class adıyla oluşturabiliyoruz.
            //namespace adını kullanmıyoruz çünki yukarıdaki using directive ile namespace kodumuza ekledik.
            //böylece namespace adını kullanmadan  direk class adıyla instance ımızı oluşturuyoruz.
            abc fobj = new abc();
            efg sobj = new efg();

            fobj.func();
            sobj.func();

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Nested Namespaces...");

            xyz  prnt = new xyz();
            wwww chld = new wwww();

            prnt.func();
            chld.func();

            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static void MainMethod(string[] args)
        {
            abc obj = new abc();

            obj.func();
            xyz obj2 = new xyz();

            obj2.func();
            Console.ReadKey();
        }