2

Writing a C# Program

Now that you've spent some time learning what C# is and how it fits into the .NET Framework, it's time to get your hands dirty and write some code. You use Visual Studio 2005 (VS) throughout this book, so the first thing to do is to have a look at some of the basics of this development environment. VS is an enormous and complicated product, and can be daunting to first-time users, but using it to create basic applications can be surprisingly simple. As you start to use VS in this chapter, you will see that you don't need to know a huge amount about it in order to start playing with C# code. Later on in the book you will see some of the more complicated operations that VS can perform, but for now a basic working knowledge is all that is required.

Once you've had a look at VS, you put together two simple applications. You don't need to worry too much about the code in these for now, you just prove that things work and run through the application creation procedures that will become second nature before too long.

The first application you create is a simple console application. Console applications are those that don't make use of the graphical Windows environment, so you won't have to worry about buttons, menus, interaction with the mouse pointer, and so on. Instead, you will run the application in a command prompt window, and interact with it in a much simpler way.

The second application is a Windows Forms application. The look and feel of this will be very ...

Get Beginning Visual C#® 2005 now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.