Possible duplicate:If use should be inside or outside the namespace
I am looking at a code base where the author (I respect) sequentially puts the use of operators inside the namespace, as opposed to above it. Is there any advantage (more efficient GC?) For this or is it just a code style preference?
Cheers,Berryl
If you have multiple namespaces in one file, you will determine the scope only in the namespace, and not in the entire namespace in the entire file.
. ( ) "" ?
, "global::", .
namspace bar { using foo //this may mean "using global::bar.foo OR using global::foo" }
http://blogs.msdn.com/b/ericlippert/archive/2007/06/25/inside-or-outside.aspx?wa=wsignin1.0
, , .
using Bar; namespace Foo { using Bar; namespace Bar { class C { } } namespace Baz { class D { C c = new C(); } } } namespace Bar { class E { } }
using , Foo. , Foo. Foo , .
. , `using global:: Bar; ', Out Bar, - D C.
MS . , stylecop, .
Check out Is sa1200 Should all directives used be placed in the namespace (StyleCop) purely cosmetic? for more in-depth discussion
Source: https://habr.com/ru/post/1748616/More articles:Rails relational table with multiple identifiers from one table - ruby-on-railsPHP - Which is faster, memcache or required? - phpUsing C # WATIN, how do I get the value of the html element of an INPUT tag? - c #hierarchical clustering with gene expression matrix in python - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1748615/macros-to-set-and-clear-bits&usg=ALkJrhh77ZmU9Uwd2EM6Rhas-keNkFvkNgConfiguration Management for FPGA Designs - cHow can I create Google search style suggestions using Javascript / AJAX? - javascriptWhy repeat database restrictions in models? - databaseПлагин Maven для причала и каталог ресурсов - javaDependency Injection, IoC and Mocking are finally explained in a simple and understandable way! - dependency-injectionAll Articles