Click here to Skip to main content
15,909,437 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to aaccess public members of one namespace A in another namespace B.
Posted

C#
namespace DLNameA
        {
            public class DLA
            {
                public DLA()
                {

                }
                public int inta = 15;
                public int Add(int a, int b)
                {
                    return a + b;
                }
            }
        }


        namespace BLA
        {
            using DLNameA;
            public class BLA
            {
                public BLA()
                {

                }

                public void SetData()
                {
                    DLA ob = new DLA();
                    ob.Add(5, 5);
                }

            }
        }
 
Share this answer
 
C#
namespace SomeNameSpace
{
    public class MyClass 
    {
        static void Main() 
        {
            Nested.NestedNameSpaceClass.SayHello();
        }
    }

    // a nested namespace 
    namespace Nested   
    {
        public class NestedNameSpaceClass 
        {
            public static void SayHello() 
            {
                Console.WriteLine("Hello");
            }
        }
    }
}
// Output: Hello


Cheers,
Edo
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900