How to use nested namespace in C#

2 Answers

0 votes
using System;

namespace ANameSpace
{
    public class Print
    {
        static void Main()
        {
            NestedNameSpace.Test.Print();
        }
    }

    namespace NestedNameSpace
    {
        public class Test
        {
            public static void Print() {
                Console.WriteLine("C#");
            }
        }
    }
}

 
   
   
/*
run:
   
C#
   
*/

 



answered Nov 26, 2020 by avibootz
0 votes
using NamespaceA.NamespaceB;
using System;

namespace NamespaceA
{
  namespace NamespaceB
  {
    class Student {
      public static string name = "Emma";
    }
  }
}

class Program
{
  static void Main(string[] args)
  {
    Console.WriteLine(Student.name);
  }
}
 
 
 
/*
run:
 
Emma
 
*/

 



answered Dec 15, 2020 by avibootz

Related questions

1 answer 154 views
1 answer 119 views
1 answer 141 views
141 views asked Jul 30, 2023 by avibootz
1 answer 124 views
124 views asked Mar 9, 2023 by avibootz
1 answer 146 views
146 views asked Dec 29, 2022 by avibootz
1 answer 123 views
123 views asked Jun 21, 2022 by avibootz
1 answer 129 views
129 views asked Apr 29, 2022 by avibootz
...