It is a time-honored tradition to start a programming book with a "Hello World" program. In this chapter, we create, compile, and run a simple "Hello World" program written in C#. The analysis of this brief program will introduce key features of the C# language.
Example 2-1 illustrates the fundamental elements of a very elementary C# program.
class Hello { static void Main( ) { // Use the system console object System.Console.WriteLine("Hello World"); } }
Compiling and running this code displays the words "Hello World" at the console. Let's take a closer look at this simple program.