The purpose of adding a reference to a project is to introduce an assembly.
What is the concept of assembly?
An assembly is a DLL, which is a prerequisite for calling a class.
An Assembly contains one or more namespaces.
For example
The namespace System. Data comes from the file System. Data. DLL.
The namespace System. Data. SqlClient is also from System. Data. DLL.
This means that once you add a reference to the System. Data Assembly file (whether you add a DLL from the GAC or directly add it to the Project)
You can use the various types of System. Data and System. Data. SqlClient
Why using?
To put it simply, you don't even need to write a using. You can use a fully qualified name for all types you need.
What is a fully qualified name?
For example, the DataSet class DataSet: System. Data. DataSet is its fully qualified name.
For example, the database connection class SqlConnection: System. Data. SqlClient. SqlConnection is its fully qualified name.
The advantage of using is that you do not have to write fully qualified names everywhere, which will make the Code look too lengthy.
Speaking of this, do you understand the role of using? In fact, it plays a short role.
The real reference work is done at the beginning, and using is just to make your subsequent coding work simple and easy.
As for the using,
In the end, it is because the class you are using has an incomplete Class Name (that is, a non-fully qualified name ),
The system does not know where the class comes from,
The system will find the source of this class in all using,
If you do not have using, you cannot find it.
The last example is as follows:
You need to define a dataset,
Method 1
Using System. Data;
Then
DataSet mySet = new DataSet ();
Method 2:
No using
Direct
System. Data. DataSet mySet = new System. Data. DataSet ();
Of course, both methods require that you add references to System. Data to the project.
Both methods are feasible, but do you think the first method is more concise?
From http://topic.csdn.net/u/20070202/13/8e124bb9-3e46-4f5e-ab4e-3c7aeeb367e0.html? 2058447783