Console Application Namespaces


Visual Basic .NET Unleashed
By Paul Kimmel
Table of Contents
Chapter 13.  Creating a Console Application

Console Application Namespaces

When you create a new console application, the Console Application template includes the System, System.Data, and System.XML namespaces by default. You do not get System.Window.Forms, precluding access to classes that allow you to define a GUI and the Application class.

System.Data includes classes in the ADO.NET architecture, allowing you to access data. System.XML offers classes for processing XML, and the System namespace is a core namespace in the CLR and includes access to classes like the Console class used throughout this chapter.


To clearly show where some capabilities came from, Listing 13.7 uses the complete path at a couple of locations. Line 120 uses the complete path to the shared methods Exists. We could have skipped the System.IO portion of the namespace because we imported that namespace at the top of the module. Line 156 uses the complete System.Collections.IComparer.Compare path to indicate that StringComparer implements the Compare interface.


Other languages in .NET do not support including a class or interface name in an Imports statement. C# (C-sharp) requires that an Imports statement only include namespaces.

If you need additional capabilities, you can add an Imports statement at the top of the module that needs a particular namespace or add the namespace on the Imports page of the Property Pages dialog box. Listing 13.7 imports the System.IO namespace.


Visual BasicR. NET Unleashed
Visual BasicR. NET Unleashed
Year: 2001
Pages: 222 © 2008-2017.
If you may any questions please contact us: