开发者

Bad to leave unused default assemblies in the reference folder?

开发者 https://www.devze.com 2023-01-16 10:06 出处:网络
There are usually some that I don\'t use in whatever project I\'m working on (System.XML, Syste开发者_运维问答m.XML.Linq for example).

There are usually some that I don't use in whatever project I'm working on (System.XML, Syste开发者_运维问答m.XML.Linq for example).

Are there any drawbacks from leaving default assemblies that I won't be using in my project?

Bad to leave unused default assemblies in the reference folder?


Unused referenced assemblies are removed by the compiler.

Create a new console app in VS and it will default reference inn several assemblies. Compile your empty program and open it in reflector, and you'll see that only mscorlib is referenced. The others are removed.

Same goes for unused using statements. The compiler removes them.

You might want to remove unused references and using for the sake of keeping things clean and more readable.


No, there is no drawback. They are only used for resolving your code against assembly metadata and if you're not using any elements in a referenced assembly, it won't affect your project's output at all.


No, the C# compiler ignores assemblies which are not actually used by the application.


I get rid of any that I don't use. Similarly, I get rid of unused using declarations.

0

精彩评论

暂无评论...
验证码 换一张
取 消