Solved

VB.net Imported Name spaces

Posted on 2012-03-11
2
210 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 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
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
Comment Utility
thanks very much
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now