What is the difference between "using System.Data;" and directly adding the reference from "Add References Dialog Box"?
Submitted by: AdministratorWhen u compile a program using command line, u add the references using /r switch. When you compile a program using Visual Studio, it adds those references to our assembly, which are added using "Add Reference" dialog box. While "using" statement facilitates us to use classes without using their fully qualified names.
For example: if u have added a reference to "System.Data.SqlClient" using "Add Reference" dialog box then u can use SqlConnection class like this:
System.Data.SqlClient.SqlConnection
But if u add a "using System.Data.SqlClient" statement at the start of ur code then u can directly use SqlConnection class.
On the other hand if u add a reference using "using System.Data.SqlClient" statement, but don't add it using "Add Reference" dialog box, Visual Studio will give error message while we compile the program.
Submitted by: Administrator
For example: if u have added a reference to "System.Data.SqlClient" using "Add Reference" dialog box then u can use SqlConnection class like this:
System.Data.SqlClient.SqlConnection
But if u add a "using System.Data.SqlClient" statement at the start of ur code then u can directly use SqlConnection class.
On the other hand if u add a reference using "using System.Data.SqlClient" statement, but don't add it using "Add Reference" dialog box, Visual Studio will give error message while we compile the program.
Submitted by: Administrator
Read Online Dot Net Job Interview Questions And Answers
Top Dot Net Questions
☺ | Creating a Key Pair in .NET? |
☺ | Explain what relationship is between a Process, Application Domain, and Application? |
☺ | Before in my VB app I would just load the icons from DLL. How can I load the icons provided by .NET dynamically? |
☺ | What’s the use of System.Diagnostics.Process class in .NET? |
☺ | What is the difference between VB 6 and VB.NET? |
Top Dot Net Technologies Categories
☺ | MSF Interview Questions. |
☺ | .Net Architecture Interview Questions. |
☺ | ASP.Net MVC Interview Questions. |
☺ | Entity Framework Interview Questions. |
☺ | C# (Sharp) Programming Language Interview Questions. |