C# Namespaces and Assemblies Best Practice

前端 未结 3 1928
终归单人心
终归单人心 2020-12-14 07:10

C#: are there any guidelines, best practices when it comes to dividing a solution up into namespaces and assemblies? Should namespaces normally be nested, with the most low

3条回答
  •  温柔的废话
    2020-12-14 07:57

    Namespaces are just fancy way of splitting full class names for user's convenience. So there are no compile/run-time penalties or gains for using namespaces.

    Splitting objects into assemblies will have impact on run-time and compile time, also it is unlikely to be high if you don't go with very large number of assemblies. Note that it is not possible to predict what you get gains or slowness without actual measurements for your particular case.

    You should divide your project into assemblies based on your logical (i.e. by subsystems)/technical(i.e. due to component versioning) needs and than verify if performance is acceptable. If not you'll need to figure out where problems are before blaming it on number of assemblies.

提交回复
热议问题