What's the costs of unused assembly references?

最后都变了- 提交于 2019-12-01 16:08:57

If you reference an assembly in a project but actually don't use any types in that assembly the unused assembly will not be part of your final product. The reference is removed at compile time.

The only "overhead" of referencing unused assemblies is during development where referencing many unused assemblies may confuse the developer about what dependencies the project has. Each new assembly in your project will also create some overhead for IntelliSense and the compiler but in most cases you wont notice.

ReSharper has a function to analyze if a referenced assembly is unused.

In my opinion the organizational overhead for me (and my co-workers) to even think about unused references (why do we need XML here?) is enough motivation to remove them. Consequently, I have never considered the impact on deployment or performance.

If you use nothing from the assembly then they are stripped out when compiled so the cost is nothing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!