An Introduction to the .NET FCL, Part 3
Pages: 1, 2, 3, 4, 5
|
Related Reading
VB.NET Core Classes in a Nutshell |
Microsoft.VisualBasic
System
System.Collections
System.Data
System.Diagnostics
Microsoft.VisualBasic
System
System.Collections
System.Data
System.Diagnostics
Microsoft.VisualBasic
System
System.Collections
System.Data
System.Diagnostics
Microsoft.VisualBasic
System
System.Collections
System.Data
System.Diagnostics
System.Management
Microsoft.VisualBasic
System
System.Collections
System.Data
System.Diagnostics
System.Drawing
System.Windows.Forms
Microsoft.VisualBasic
System
System.Collections
System.Data
System.Diagnostics
System.Drawing
System.Windows.Forms
Microsoft.VisualBasic
System
System.Collections
System.Data
System.Diagnostics
In addition, the AssemblyInfo.vb file automatically imports two additional namespaces, System.Reflection and System.Runtime.InteropServices, into every project.
You can have Visual Studio automatically import a particular namespace, which makes it available to all of the source code files in a project, as follows:
-
Select Project
Properties from the main menu, or right-click
on the project name in the Solution Explorer window and select Properties
from the popup menu to open the properties dialog. -
Select Common Properties
Imports in the treeview control
on the right to display the Imports property page. -
Enter the fully qualified name of the namespace you'd like to import in the Namespace dialog and click the Add Import button. Repeat this step for each namespace you'd like to automatically import in the project.
-
Click OK to close the property page.
While the use of the Imports directive can save a substantial amount of typing, it does mean that the compiler is left to identify the namespace containing a particular type. This means that, if identically named types are found in the imported namespaces, Visual Basic will not be able to determine which type you wish to instantiate. For example, consider the code in Example 1-6, which defines two custom namespaces, each with a class named Person.

