简体   繁体   English

输入别名或完整名称空间

[英]Type alias or full namespace

Does it affect performance to use type alias rather than full namespace? 使用类型别名而不是完整名称空间会影响性能吗? For example, import just Form class using Form = System.Windows.Forms.Form; 例如, using Form = System.Windows.Forms.Form;仅导入Formusing Form = System.Windows.Forms.Form; or import all types using System.Windows.Forms; using System.Windows.Forms;导入所有类型using System.Windows.Forms;

No this has absolutely no affect on the performance of your application. 不,这绝对不会影响应用程序的性能。 This could in theory have an affect on compilation time. 从理论上讲,这可能会影响编译时间。 But it would almost certainly be insignificant. 但这几乎是微不足道的。

两者都没有完全一样的性能,只是个人喜好-它被编译为相同的代码。

绝对没有区别-编译器会在运行之前对其进行解析。

否。在运行时没有任何问题(生成的二进制文件是相同的),并且编译时的影响实际上可以忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM