Search code examples
c#conventions

Where to store class files?


I usually make a separate class library for my projects and then break it up into folders

Services
 -all my .cs files that are service(business logic)

Data
 - Mapping 
   - nhibernate mapping files

Domain
  - domain files

I also create other folders like for instance I am doing stuff with foursquare so for all the class files for it are in a folder called "foursquare"

but what I don't know where to put one off class files. Like for instance I have "HtmlWhiteList" class what is the only kind of white list.

I don't think it should have it's own folder since it is just one file but at the same time I don't like just having it in the root.

Any suggestions where to put class files that don't deserve their own folder?


Solution

  • As a general rule of thumb, I put new class files just in the root of the other class calling it. If I get 5 or more similar classes, I'll create a folder and put them in the folder on that same level.