没有'使用'提供任何好处? [英] does 'using' provide any advantages?
问题描述
当您引用某些方法,您可以使用使用
或明确键入整个命名空间。是否有使用一种方法比其他任何速度上的优势,还是来这里只是为了让打字出整个空间更容易?谢谢
When you reference certain methods, you can either use using
or explicitly type in the entire namespace. Are there any speed advantages of using one method over the other, or is it simply there to make typing out the entire namespace easier? thanks
推荐答案
有在运行时没有区别。
在.NET的元数据,一类是使用全名,其中包括命名空间始终代表,因此使用C#中称为
指令程序编译时会消失。
In the .NET meta-data, a type is always represented using a full name that includes the namespace, so the using
directive known from C# will disappear when a program is compiled.
有一些细微的方面(在编译时),当谈到写使用
内部或外部的命名
(例如,见这个问题),但是这也只有编译时间问题。
There are some subtle aspects (at compile time) when it comes to writing the using
inside or outside of a namespace
(see for example this question), but that's also only a compile-time issue.
这篇关于没有'使用'提供任何好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!