Lets say we have the following file and [folder] structure in a project with a main namespace of MyNamespace
:
- [Entities]
- Article.cs
- Category.cs
- [Interfaces]
- IReviewable.cs
- ISearchable.cs
- Enumerations.cs
According to ReSharper's suggestions, the namespace of the classes Article
and Category
should be MyNamespace.Entities, the namespace of IReviewable
and ISearchable
should be MyNamespace.Interfaces and the namespace for the Enumerations
class should be simply MyNamespace.
This is because ReSharper's suggestions are based on the folder structure depending and its suggestions are based on where th file is located in the structure.
What do you think of the above namespaces? Do you think that it is correct to implement namespaces for classes (interfaces etc...) solely on their folder location?
Or do you think that namespace declaration shouldn't depend solely on the folder structure?
Personally, I would put all the above files under the single MyNamespace since they are all kind-of related to one another.