interface Object { guid: "4E9538F2-03E0-11DA-A88E-000A95BB581A"; }; namespace A { struct D { }; struct F { }; // A.G is declared as a namespace; no attempt is made to look for // a global G. struct G.Q { }; } struct B { struct C { struct X { }; }; struct G { }; struct H { }; struct I { }; }; struct D { // Imports B and B.C, not B and C. If it were "using C.*, B.*", // then it would import C and C.B. using B.*, C.*; using System.B.I; struct E { // B b; // Error, Uses C.B, rule #2 once D is reached. Only the // contents of namespaces are imported, not the // names themselves. // C.D cd; // Error. For the same reason as above, C refers // to B.C, not C. There is no D in B.C. C.X cx; // Uses B.C.X. D d; // Uses C.D, rule #2 when D is reached. D itself // is declared in the global namespace, which doesn't // get reached because a match is found sooner. E e; // Uses D.E, rule #1 once D is reached. C.E would // have been matched by rule #2 if D.E did not exist. F f; // Uses C.F, rule #2 once D is reached. A.F is not // matched, as importation is not transitive. G g; // Uses B.G, rule #2 // H h; // Error, both B.H and C.H match on rule #2 once // D is reached. B does not get precedence for // coming first, or because the C importation // comes after this lookup. I i; // Uses B.I, as specific-symbol imports are treated // as symbols declared in this namespace, rather than // imports (and thus B.I has precedence over C.I). }; // int I; // Error; this conflicts with the specific-symbol // importation of B.I. // Now C is imported. This importation is valid through the // entire namespace (except for prior using statements), not just // after this point. using System.C.*; }; namespace C { using A.*; struct D { }; struct E { }; struct F { }; struct H { }; struct I { }; struct B.E { struct F { }; struct E { }; // B b; // Error: Uses C.B, rule #1 once C is reached, // but C.B is not a type D d; // Uses C.D, rule #1 once C is reached B.E be; // Uses C.B.E, rule #1 once C is reached E e; // Uses C.B.E.E, rule #1 in current namespace // E.E ee; // Error, as the first E matches C.B.E.E, and // there is no C.B.E.E.E. The extra .E is // not used for disambiguation. F f; // Uses C.B.E.F, rule #1 in current namespace // G g; // Error: Uses A.G, rule #2 once namespace C is reached. H h; // Uses C.H, rule #1 once namespace C is reached. }; }