.net中未使用的使用会影响性能吗?

可能重复:
为什么要删除不必要的C#using指令?
性能如何受未使用的using语句的影响

c#中未使用的使用会影响运行时性能吗? 如果是的话,怎么做?

using System; using System.Collections.Generic; using System.ComponentModel; -----//Unused using System.Data;---------------//Unused using System.Drawing;-----------//Unused using System.Text;-------------//Unused using System.Windows.Forms; using System.Threading;------//Unused using System.Linq;----------//Unused using System.IO;-----------//Unused using System.Diagnostics;-//Unused using System.Data.OleDb; using OBID; 

不,但它会影响IDE性能和项目的编译过程。 我可以举个简短的例子。 如果您曾经使用过来自devexpress的coderush http://devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/ ,他们的IDE优化器和代码优化器也会建议您删除未使用的命名空间。

更新:以下是来自Dmitriy博客的更多使用信息您应该删除C#代码中未使用的用法的原因很少。

 •It is useless code, that just creates clutter in your source code and it also confusing for the developer because you don't know which namespaces are actually used. •Over time as your code changes it can accumulate a lot of unused using statements which create even more clutter in you code. •It can make your compiling faster, since compiler does not have to look up all those extra unused namespaces. •It will help avoid name conflict with new items that you going to add to your solution if both of those have same names. •It will reduce number of items in your Visual Studio editor auto completion 

有几种方法可以删除那些未使用的使用,您可以在每个文件上单独执行

http://msdn.microsoft.com/en-us/library/bb514115.aspx

您还可以下载Visual Studio 2010中名为batchFormat的插件,它可以帮助您删除整个项目的所有未使用的使用。

http://www.addictivetips.com/windows-tips/batch-format-remove-unused-usings-and-format-visual-studio-document/

不,他们没有。 实际上,无论是否使用它们,它们都没有任何运行时间的意义。 它们只是一个编译时常量,允许编译器识别类型而不明确指定其全名。

他们的主要问题是,一个充满未using的文件会强迫你在查看代码时制作一个没有意义的PgDn。