CHAPTER 14 BUILDING AND CONFIGURING CLASS LIBRARIES
Building a Visual Basic Client Application
Recall that the .NET platform allows developers to share compiled code across programming languages.
To illustrate the language-agnostic attitude of the .NET platform, let’s create another Console
Application (VisualBasicCarClient), this time using Visual Basic (see Figure 14-9). Once you have created
the project, set a reference to CarLibrary.dll using the Add Reference dialog box, which can be
activated by the Project Add Reference menu option.
Figure 14-9. Creating a Visual Basic Console Application
Like C#, Visual Basic allows you to list each namespace used within the current file. However, Visual
Basic offers the Imports keyword rather than the C# using keyword, so add the following Imports
statement within the Module1.vb code file:
Imports CarLibrary
Module Module1
Sub Main()
End Sub
End Module
Notice that the Main() method is defined within a Visual Basic module type. In a nutshell, modules
are a Visual Basic notation for defining a class that can contain only static methods (much like a C# static
class). In any case, to exercise the MiniVan and SportsCar types using the syntax of Visual Basic, update
your Main() method as follows:
Sub Main()
Console.WriteLine("***** VB CarLibrary Client App *****")
524