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,既然未使用,放在那里岂不成了多余的了,删掉的话会使代码变得简洁一些。
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,既然未使用,放在那里岂不成了多余的了,删掉的话会使代码变得简洁一些。
相关文章推荐
- ASP.NET Forum 中禁用含有子版块的版块后产生的"未将对象引用设置到对象的实例"异常的处理方法
- win7 Visual Studio 2008 安装程序时出现“ 加载安装组件时遇到问题。取消安装。”处理方法
- ERROR 1045 (28000): Access denied for user 'git'@'localhost' (using password: YES) 的处理方法
- C # 项目 Visual Studio 2005 IDE 中时错误信息: " 绑定: 句柄无效 " 处理方法
- C# 001 --- 正确的删除一个控件的事件函数 --- 解决错误: “A”不包含“B”的定义,并且找不到可接受类型为“A”的第一个参数的扩展方法“B”(是否缺少 using 指令或程序集引用?)
- iOS程序开发引用的第三方库之间出现duplicate symbol时的处理方法
- mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”的处理方法
- 在运行jar包的过程中处理引用第三方jar包方法
- mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”的处理方法
- [Visual studio] Visual studio 2017添加引用时报错未能正确加载ReferenceManagerPackage包的解决方法
- 新笔记本安装 Visual Studio 2015 Enterprise,安装失败提示 setup blocked的处理方法。
- Visual Studio中,引用与Using的区别
- USING STATIC IMPORTS FOR CONSTANTS AND METHODS(使用静态导入引用常量与方法)
- vs2010无法添加dll引用的处理方法
- Visual Studio 2010 命名空间“Microsoft”中不存在类型或命名空间名称”。是否缺少程序集引用中错误的处理
- QTCreater编程错误:LNK2019: 无法解析的外部符号 __imp__ShellExecuteW@24,该符号在函数 _main 中被引用 的 错误处理 及 添加外部库与头文件 的方法
- iOS程序开发引用的第三方库之间出现duplicate symbol时的处理方法
- Visual studio 2017添加引用时报错未能正确加载ReferenceManagerPackage包的解决方法
- iOS程序开发引用的第三方库之间出现冲突的处理方法