Assuming it is namespace A2nested in namespace A1, then it A2is a member of the inclusion A1. But the members A2(thus declared in A2) are not members A1.
a) What specifically means that members A2are not members A1? In other words, what would be different if they were also members A1? Is it possible that inside A1we would not need to use the full name for the types defined in A2?
b) What exactly means that the namespace A2is a member A1?
BTW - I understand namespaces, I'm just confused by the terminology used by my book (namely, A2 is a member from A1, etc.)
thank
EDIT
1) Thus, essentially A2being a member A1, is the reason that inside A1we do not need to specify A1. prefixwhen referring to types declared in A2:
namespace A1
{
class Program
{
static void Main(string[] args)
{
A2.classA2 a2= A2.classA2();
prefix
}
}
namespace A2
{
class classA2 { }
}
}
2) In assembly asmLibrary.dll
The following are defined:namespace A
{
public class A1{}
namespace B
{
public class B1{}
}
}
The following appendix App1also has a link to the assembly asmLibrary.dll:
namespace A
{
class Program
{
static void Main(string[] args)
{
B.B1 instanceB1 = new B.B1();
}
}
}
The following application App2has a link to the assembly asmLibrary.dll:
using A;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
A.B.B1 bInstance = new A.B.B1();
A1 a1 = new A1();
}
}
}
a) When we tried to declare to an App2instance A.B.B1, we needed to specify the full name of the type. But App1we were allowed to specify the type through B.B1. Thus, why were we allowed to omit the prefix A.inside App1, but not inside App2(it App2has a directive using A;, so its behavior should be identical to that App1)?
b) , namespace B namespace A, App2 A.B.B1 B.B1 instanceB1 = new B.B1();?!