Read More on Telerik Blogs
July 04, 2008 People
Get A Free Trial

If you like us are passionate user of ReSharper you know that ReSharper "did not like" when a class' namespace did not correspond to the directory structure the file belongs to. To illustrate this lets look at a simple example.

Imagine that we have a project named MyProject. By default its namespace is MyProject. Lets have a folder named MyControls in the project as well. Now lets add a class file in that folder, naming it "MyControl.cs". The default namespace that will be generated for the class will be MyProject.MyControls. It is constructed using the default namespace and joining it with the folder name. But if we change the namespace to be only MyProject, ReSharper will warn us with:

However, sometimes we may not want this behavior. We may just want to have a folder, which name will not participate in the default class' namespace. How to achieve this? Just in two easy steps:

1. Right click on the folder and choose properties.

2. Change the Namespace Provider combo box value from True to False.

 

Now ReSharper will be happy and everything will be fine. Peace.


About the Author

Yasen Yankov

Yasen Yankov currently leads one of the Sitefinity engineering teams. Prior to that, he spent 5 years developing and maintaining Sitefinity applications as part of the Progress web team. He has worked on complex web projects like telerik.com, progress.com, sitefinity.com and nativescript.org