本文介绍了未使用using语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能已经知道这个问题的答案,但我认为这是值得一问反正。如果我有使用的负载不的使用我的代码文件中的语句的;




  1. 这是否有任何形式的不利影响性能?

  2. 如何在编译/运行时间与他们做编译器处理?



感谢


解决方案


没有。



No.

At compile time they do what you'd expect, i.e. act as namespace imports. They don't appear in the compiled binary: any reference to a type uses the fully-qualified name.

The compiler does check the namespace in a using statement even if it's not needed; if you remove a namespace, then all the using statements that refer to it will fail.

To me, redundant using statements are like redundant comments. They make no difference to the compiler, but include too many of them, and you risk confusing your developers.

这篇关于未使用using语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 22:34