What is the difference between add your imports inside the NameSpace or Outside. Is there a difference in the way assemblies are loaded?
Using System; namespace test { } VS namespace test { using System; }
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Putting the the using statement inside the namespace makes it local to that namespace, outside the namespace means anything in the file can reference it. The complier will always search the inner most namespace first.
Stylecop promotes putting the ‘using’ statement inside the namespace and Microsoft claims that placing the using statement inside the namespace allows the CLR to lazy load at runtime. However there is a number of tests that have questioned this.