what’s the difference for the following two ways to define namespace?
namespace A.B.C {
public class AA{
}
}
namespace A {
namespace B{
namesapce C{
public class AA{
}
}
}
}
in some where I may have
namespace A{
//some classes
}
namespace A.B {
//some classes
}
namespace A {
namespace B {
//some classes
}
}
Both need to do the same to use class AA by using A.B.C; Can I use C.AA a; to specify the AA class in C namespace or I have to use the fall namespace convention: A.B.C.AA a; to avoid possbile confliction?
They’re the same. If you look at this code in .NET Reflector:
you get this:
Both methods are compiled to exactly the same intermediate language code.