Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用类型别名而不是完整命名空间会影响性能吗?例如,只导入Form类 using Form = System.Windows.Forms.Form; 或导入所有类型 using System.Windows.Forms;
Form
using Form = System.Windows.Forms.Form;
using System.Windows.Forms;
不,这绝对不会影响您的应用程序的性能。这在理论上可能会影响编译时间。但这几乎可以肯定是微不足道的。
没有两者具有完全相同的性能,这只是个人喜好 - 它被编译成相同的确切代码。
绝对没有区别 - 它在运行之前由编译器解决。
不。在运行时没有任何东西(生成的二进制文件是相同的),编译时的影响实际上可以忽略不计。