Visual Studio Express:
Introduction to the C# Programming Language
Author: Rich Tebb
Company: Content Master Ltd
The Visual Studio Express family provides a free, lightweight, and easy-to-learn suite of programming tools that are aimed at the hobbyist, novice, and student developer. Many people in this category will not have had any formal training in computer science, and indeed they may not have any programming experience at all. If you fall into this category, don’t worry – this guide is for you! This beginner’s guide is designed for people with little or no prior knowledge of computer languages, who want to learn to program by using the C# language. If you have some previous programming experience, maybe in another language or from a few years ago, then you may also find this guide useful. If you are a professional developer, or you are already skilled in one or two programming languages, then you will probably not have much to learn from this document. Whether or not you have programmed before, you should already be familiar with computers before reading this guide. It assumes that you can perform simple tasks like starting a program, and that you are familiar with navigating around your computer by using Windows Explorer. So what will you learn by reading through this guide? Well, the most important thing you can learn is that Programming is Fun! It’s a great feeling of satisfaction when you finish a program and it does what you want – whether your program is a computer game that you’ve invented, or it controls a robotic device, or serves any other purpose that you can imagine. There may be obstacles along the way – like any challenge, programming can present difficulties – but when you see your finished program working, you can take pride in the fact that you overcame the problems, and converted your imagination into reality. As well as – we hope – learning that programming is fun, in this guide you will learn how to create a simple program. Your program will include basic but essential programming techniques such as methods, variables, controlling program flow, and how to create your own classes – the fundamental structural units of a C# computer program. Although you will be using Visual Studio tools to create your program, this is not a guide to the full features of Visual Studio. You can learn more about how to use Visual Studio in other MSDN guides.
What is Programming?
Contrary to popular belief, computers are not clever. Left to itself, a computer doesn’t do anything at all – it won’t show the time, or display what you type on the screen, let alone play a video game. The reason that computers are such useful tools, and give the appearance of cleverness, is that they follow instructions, very accurately, very repetitively, and very quickly. For example, when a computer displays a clock, it does so because it has instructions for how to draw every color and tick mark in the clock face, and every line in the clock’s rotating hands, onto the computer screen. Programming is the act of giving instructions to a computer so that it knows how to perform an action. Fundamentally, these instructions are a series of numbers – to a computer, everything is numbers – in a kind of code where different numbers represent different instructions. The good news is that programmers don’t have to learn all these numbers (the ‘machine code’), because they can write their instructions in a more intuitive form, and then have the computer convert these instructions into machine code. The intuitive or human-readable form of instructions is called a computer language. Like languages in the real world, there are dozens of computer languages. Some are for specialized tasks and others are more general-purpose. What all programming languages have in common is that they enable programmers...