Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi,

i faced the question difference between import and using ?
some say import works in vb where as using works in c# .
some say when u use code behind 'using' works else 'import' works.
i am confused.can somebody give me the correct answer.




thanks in advance
Posted

Import is used in VB to "import" a namespace.
using is used in C# to "import" a namespace or it defines a scope at the end of which an object will be disposed

using C#[^]

Imports Statement in VB[^]
 
Share this answer
 
Comments
Uday P.Singh 31-Jul-11 3:38am    
correct my 5!
Kim Togo 1-Aug-11 2:36am    
Thanks
walterhevedeich 31-Jul-11 5:16am    
Correct.
import/using a namespace depends on which language you have chosen to create your application.

The Import statement is VB.NET specific.
The using statement is C# specific.

for example if you want to use the namespace System.Data.SqlClient in your application then:

In C# you write:

C#
using System.Data.SqlClient;


In VB.net you write:

VB
Imports System.Data.SqlClient


They both perform the same thing, but they are specific to that particular language.

hope it helps :)
 
Share this answer
 
Comments
walterhevedeich 31-Jul-11 5:16am    
Correct.
Kim Togo 1-Aug-11 2:36am    
My 5.
Uday P.Singh 1-Aug-11 11:59am    
thanks kim :)
Hope it helps,

Imports[^]

Using[^]

:)
 
Share this answer
 
Comments
walterhevedeich 31-Jul-11 5:16am    
Correct.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900