Namespaces and folder structures in c# solutions: how should folders on disk be organised?

前端 未结 8 739
野趣味
野趣味 2021-02-04 06:26

First off, let’s agree that namespace should match folder structure and that each language artefact should be in its own file.

(see Should the folders in a solution ma

8条回答
  •  深忆病人
    2021-02-04 06:42

    I use the flat approach. I find a nested hierarchy too hard to maintain. I group my projects into several solutions, with maximum reusability and cross-referencing in mind, and always found this satisfactory. Example (projects are indented):

    CompanyName
      CompanyName.Core
        Class1
        Struct2
        Enum3
      CompanyName.Data
      CompanyName.Web
    
    CompanyName.Projects
      CompanyName.Projects.Core
    
    CompanyName.Projects.ProjectX
      CompanyName.Projects.ProjectX.Core
      CompanyName.Projects.ProjectX.Website
      CompanyName.Projects.ProjectX.ToolY
    

    etc. etc.

    Edit: removed nonsense remark

提交回复
热议问题