imageIf 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:

ReSharper-File-Namespace

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.

image 

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


yasen
About the Author

Yasen Yankov

Yasen Yankov

Comments

Comments are disabled in preview mode.