Section 1.5. The Structure of C Applications


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 below. For now, observe that the program is readable; it is in normal text. The words may be strange and the layout unusual, but there are no special charactersjust 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 (explained shortly). Once compiled, your program must be run and tested .

Although 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 2005. Visual Studio 2005 was designed with .NET development in mind, and greatly simplifies the writing of C# program code. This book assumes you are using Visual C# 2005 Express or Visual Studio 2005, both of which provide the Visual Studio 2005 development environment.

The overwhelming majority of C# programmers will be building Windows and web applications for the .NET platform using the Visual Studio 2005, and all the examples for this book have been tested in that environment.

A free version of this popular product, called Visual C# 2005 Express Edition, is available for download at http://msdn.microsoft.com/vstudio/express/visualcsharp/.

There are excellent open source C# compilers available, such as those from the Mono project (http://www.mono-project.com) and SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/). Everything in this book should work with those compilers, but we have not tested with them and can not guarantee 100% compatibility.




Learning C# 2005
Learning C# 2005: Get Started with C# 2.0 and .NET Programming (2nd Edition)
ISBN: 0596102097
EAN: 2147483647
Year: 2004
Pages: 250

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net