[英]Solution explorer of visual studio
In solution explorer of asp.net application we are adding something in References section for eg:in our project there are sample.Dal,sample.exeption ,system.core etc 在asp.net应用程序的解决方案资源管理器中,我们在“引用”部分添加了一些内容,例如:在我们的项目中,有sample.Dal,sample.exeption,system.core等
What is actually References means,,,can we add by 'using' statement 引用实际上是什么意思,可以通过“ using”语句添加
Using is used for namespace resolution. using用于名称空间解析。 For example: 例如:
using System.Data;
lets you access the DataSet class without typing in the fully qualified name; 使您无需输入标准名称即可访问DataSet类; System.Data.DataSet. System.Data.DataSet。
This doesn't however tell the compiler what assembly (DLL) the DataSet class lies in. So you need to tell it. 但是,这不会告诉编译器DataSet类所在的程序集(DLL)。因此,您需要告诉它。 So you refer to System.Data.dll by adding it to the references section in solution explorer. 因此,您可以通过将System.Data.dll添加到解决方案资源管理器中的“引用”部分来对其进行引用。
Yes, once you reference another project or assembly, it's namespaces and types are available for use in the project that references them (you must reference the project or assembly before you can use the types within it). 是的,一旦您引用了另一个项目或程序集,它的名称空间和类型就可以在引用它们的项目中使用(您必须先引用该项目或程序集,然后才能在其中使用类型)。
You can either use using
declarations or fully-qualified type declarations to access the types, as in: 您可以使用using
声明或完全限定的类型声明来访问类型,如下所示:
// Example1: The using keyword.
using System;
void Example1()
{
Int32 myExample;
// etc.
}
// Example2: Fully-qualified type.
void Example2()
{
System.Int32 myExample;
// etc.
}
Note: I have used C# here. 注意:我在这里使用过C#。
A reference
references assemblies required for the current project. reference
引用了当前项目所需的程序集。 Where using
statements reference namespaces for the current file. using
语句的地方引用当前文件的名称空间。
And yes, a referenced namespace must exist in one of the referenced assemblies. 是的,一个引用的名称空间必须存在于一个引用的程序集中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.