使用和Java导入C#的区别 [英] Difference between c# using and Java import
问题描述
我知道,在java中,我们使用*(星号),以导入包中的所有内容如
进口的java.lang。*;
那么我们为什么不使用相同的*(星号)在C#中导入所有的内容是有没有像在Java中导入所有内容的任何方法。
之间有什么
进口java.awt中的*。
和
使用System.Windows.Forms的;
什么是Java的导入
做什么.NET被称为参考 - 添加的引用的在.NET程序集,您可以使用该程序集中定义的(公共)类型。
使用指令 C#的 是简单地访问这些类型而无需键入出整个空间的一种方式。
您可以也的使用指令来提供命名空间的别名。
I know that in java that we use *(asterisk) to import all the contents in a package like
import java.lang.*;
Then why don't we use same *(asterisk) in C# to import all the contents is there any method like in java to import all the contents. What is the difference between
import java.awt.*;
and
using System.windows.forms;
What the Java import
does what .NET is called a reference - adding a reference to an assembly in .NET allows you to use the (public) types defined in that assembly.
The C# using
directive is simply a way to access these types without typing out the whole namespace.
You can also use the directive to provide namespace aliases.
这篇关于使用和Java导入C#的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!