DekGenius.com
Team LiB   Previous Section   Next Section

1.5 The Structure of C# Applications

At the most fundamental level, a C# application consists of source code. Source code is human-readable text written in a text editor. A text editor is like a word processor, but it puts no special characters into the file to support formatting, only the text. A classic text editor is Notepad.

Example 1-1 shows an example of a very simple source code file.

Example 1-1. A source code file
namespace NotePad
{
   class HelloWorld
   {
      // every console app starts with Main
      static void Main()
      {
         System.Console.WriteLine("Hello world!");
      }
   }
}

This program is explained in detail in Chapter 2. For now, observe that the program itself is readable; it is in normal text. The words may be strange and the layout unusual, but there are no special characters — just the normal text produced by your keyboard.

Once you write your program in an editor, you must compile it. For that you need a compiler. You will learn how to use the C# compiler in Chapter 2. Once compiled, your program must be run and tested.

While you can perform all of these tasks using Notepad (or another text editor) and various command-line tools, your programming life will be much easier if you use the Integrated Development Environment (IDE) called Visual Studio .NET. VS.NET was designed with .NET development in mind and greatly simplifies the writing of C# program code.

    Team LiB   Previous Section   Next Section