您的位置:首页 > 其它

Visual Studio对无用引用(unused using)的处理方法

2012-02-22 10:53 169 查看
以前以为添加到代码中的using都会被编译器编译,其实是不对的,微软有这样一段解释:

Visual Studio notices when your code doesn’t use all of the libraries your
project references, and automatically omits references to any unused
libraries. This makes your binary slightly smaller than it would be if
unnecessary references were left in.

翻译过来就是Visual Studio会自动忽略未使用的using,即使有未使用的using,它们也不会被编译,最终也不会出现在exe或者dll中。

不过建议Code完之后还是自动清除一下未使用的using,既然未使用,放在那里岂不成了多余的了,删掉的话会使代码变得简洁一些。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐