c# - Stacking namespaces can't be referenced just like any other element? -


So here's a snippet I have made where one namespace (inside the BA) is inside the other. Generally when you use 'space'; You can access all the elements without typing SpaceA. This is the case for class A, but I can not see Spaceby without typing Space space B. Why is it like this? Here's the code:

  using the system; Using SPACE; Namespace space {class A (public A) {console. Weedline ("A"); }} Namespace spacebase {public square b {public b () {console. Vitiline ("B"); }}}} Namespace test CSARP {class program {static zero main (string [] arg) {// it does not spacesby B. B x = new space b. B (); // This works SpaceA.SpaceB.B y = New SpaceA.SpaceB.B (); Usually when you use space; 'You can access all the elements without typing the space.   

Only direct types which are members of SpaceA a name-place-or-type-name Never using a normal director, using a namespace is not solved, and then another "nicknamepace" is used on the name. Note that it has nothing to do with how it has been declared (in the case of the nested namespace declaration or just Namespace space. Spacebie ) - another example would be:

< Pre> using system; ... Xml.Linq.XElement x = faucet; // Invalid

See Section 3.8 of the C # 5 specification for exact details of the name resolution.

An minor difference is when you have to use the nicknames for a namespace, at that point to see other namespaces Can be used for

  x = system. Xml; ... X.Linq.XElement x = faucet; // valid  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -