Chapter 2: Learning Just Enough C# or VB.NET: Basic Syntax

43

The using directives at the top of the C# part of Listing 2-1 are really a shortcut that makes it easier for you to write code. For example, the System namespace contains the Console class. If the using System directive were not present, you would be required to write System.Console.WriteLine instead of just Console.WriteLine. This was a short example, but using directives can help clean up your code and make it more readable.

A VB module must be declared at the global level, meaning that it can’t be added to a namespace that you create. The following example demonstrates what a VB namespace looks like:

Namespace FirstProgram

Public Class Customer

End Class

End Namespace

In this example, you can see that the FirstProgram namespace contains a Customer class. The next task you’ll want to take on is writing code, but before doing so, let’s look at some of the features of the VS Code editor.

An Overview of the VS Code Editor

The VS Code editor is where you’ll be performing much of your coding work. This section will point out a few features you will be interested in and show you how to perform customizations. Figure 2-3 shows the editor with the Console application skeleton code from the C# part of Listing 2-1.

Figure 2-3 The VS Code editor

Page 66
Image 66
Microsoft 9GD00001 manual An Overview of the VS Code Editor, VS Code editor