O'Reilly logo

C# 2008 Programmer's Reference by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. C# Language Foundations

The best way to get started in a new programming language is to create a simple program and then examine the various parts that compose it. With this principle in mind, you'll create a simple C# program — first using Visual Studio 2008 and then using a plain text editor.

In this chapter you build and run the HelloWorld application, using Visual Studio 2008 as well as using the command line. After that, you tackle the syntax of the C# language and all the important topics, such as:

  • C# keywords

  • Variables

  • Constants

  • Comments

  • XML documentation

  • Data types

  • Flow control

  • Loops

  • Operators

  • Preprocessor directives

Using Visual Studio 2008

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

  1. Launch Visual Studio 2008.

  2. Create a new Console Application project by selecting File

    Editions of Visual Studio 2008
  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. Figure 3-1

  4. Click OK. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required