Книга: C# 2008 Programmer

Using Visual Studio 2008

Using Visual Studio 2008

The easiest way to create your first C# program is to use Visual Studio 2008. 

Editions of Visual Studio 2008

You can use any of the following editions of Visual Studio 2008 to create a C# program:

? Visual C# 2008 Express Edition

? Visual Studio 2008 Standard Edition

? Visual Studio 2008 Professional Edition

? Visual Studio 2008 Team Suite Edition

All the code samples and screen shots shown in this book were tested using Visual Studio 2008 Professional Edition.

1. Launch Visual Studio 2008.

2. Create a new Console Application project by selecting File?New?Project.

3. Expand the Visual C# item on the left of the dialog, and select Windows. Then, select the Console Application template on the right (see Figure 3-1). Name the project HelloWorld.


Figure 3-1

4. Click OK. Figure 3-2 shows the skeleton of the console application.


Figure 3-2

5. Type the following highlighted code into the Main() method as shown:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HelloWorld {
 class Program {
  static void Main(string[] args) {
   Console.WriteLine("Hello, world! This is my first C# program!");
   Console.ReadLine();
   return;
  }
 }
}

6. To debug the application and see how it looks like when executed, press F5 in Visual Studio 2008. Figure 3-3 shows the output in the Console window.


Figure 3-3 

To return to Visual Studio 2008, press the Enter key and the console window will disappear.

Оглавление книги


Генерация: 0.697. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз