Imported Namespaces (+2 VB.Net)

In Visual Studio 2005, under the project properties, VB.Net has an “Imported namespaces” section, which allows you to define namespaces used by the entire project.

This means that VB.Net files have far fewer lines because each one does not need to begin with something like:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;

Multiply this by the number of files in a project, and you have quite a lot more code.


1 comment so far

  1. hobbit on

    This is not really an advantage since you can’t tell by quickly looking at the file which namespaces (and hence which libraries) a particular file is dependent on. Also, it’s all fine and good until you have a name collision because you imported two namespaces that have different classes with the same name. Easy fix if you are explicitly declaring the namespaces in the two files (maybe you don’t need one of them?)

    Basically, this “feature” is completely contrary to the entire point of namespaces.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: