What are the benefits of maintaining a “clean” list of using directives in C#?

后端 未结 8 1121
予麋鹿
予麋鹿 2021-01-04 04:03

I know VS2008 has the remove and sort function for cleaning up using directives, as does Resharper. Apart from your code being \"clean\" and removing the problem of referenc

8条回答
  •  萌比男神i
    2021-01-04 04:36

    1. Less noise.
    2. Clear expectation of what types are used ("My UI layer depends upon System.Net. Wow, why?")
    3. Cleaner references: if you have the minimal set of using statements, you can cleanup your references. Often I see developers just keep throwing references into their projects, but they never remove them when they're no longer needed. If you don't have anything that actually needs a reference (and a using statement counts), it becomes trivial to clean up your references. (Why would you want to do that? In large systems that have been decomposed into components it will streamline your build dependencies by eliminating the unused deps.)

提交回复
热议问题