My environment:
- Microsoft Visual Studio 2010 C#
I’ve read many articles and comments about, how I should organize my namespaces.
http://msdn.microsoft.com/en-us/library/ms229026
So my question is quite simple. How do I get the company and project name automatically in my namespace?
If I create subfolders in my project, so I get the following pattern:
<Project>.<Folder>.<Subfolder>.<..>
Solution1:
If you go to the
Propertieswindow of yourProject, you can set theDefault namespace(including the Company Name) and also theAssembly namein theApplicationtab. Below is a screenshot of this:Now, after setting the default namespace, every time you add a new class to this project, it gets the above set namespace by default.
Another solution is, every time you add a new project to your VS Solution, in the

Add New Projecttemplate dialog, give the new projectNameequal toCompanyName.ProjectName. This way your new project’sDefault namespacewould includeCompany Namealways (CompanyName.ProjectName) as shown in the Add New Project dialog screenshot below: