Solved

VB.net Imported Name spaces

Posted on 2012-03-11
2
213 Views
Last Modified: 2012-03-11
Hi

I am using third party software in Visual Studio and notice that although I have added references to their software that the relevant items are not ticked in the import name spaces at the bottom of the project references window. Should I check these boxes? Will it make it easier to use and how?
0
Comment
Question by:murbro
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 37707599
Importing a namespace means you don't have to "fully qualify" the type name within your code. For example whereas you can type this in your code:

System.Console.WriteLine("Hello World!")

Open in new window


Do you really want to type "System" every time you want to write to the console? Instead, we often do:

Imports System

...

Console.WriteLine("Hello World!")

Open in new window


This may seem trivial for this example, but when you start getting into deeper namespaces, then the savings becomes apparent (e.g. System.Collections.Generic).

As far as checking the boxes, that is up to you. You can either check the boxes, or you can put the "Imports" statement within each file that uses something from that namespace. I believe if you check the boxes, then the imports are application-wide, whereas putting them within each file makes the import applicable just to that file.
0
 

Author Closing Comment

by:murbro
ID: 37707684
thanks very much
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question