3

Variables and Expressions

To learn how to use C# effectively, it's important to understand what you're actually doing when you create a computer program. Perhaps the most fundamental description of a computer program is that it is a series of operations that manipulate data. This is true even of the most complicated examples, such as vast, multifeatured Windows applications like the Microsoft Office Suite. Although this is often completely hidden from the users of applications, it is always going on behind the scenes.

To illustrate this further, consider the display unit of your computer. What you see on screen is often so familiar that it is difficult to imagine it as anything other than a “moving picture.” In fact, what you see is only a representation of some data, which in its raw form is merely a stream of zeros and ones stashed away somewhere in the memory of your computer. Anything you do on screen, then, whether it is moving a mouse pointer, clicking on an icon, or typing text into a word processor, will result in the shunting around of data in memory.

Of course, there are less abstract situations that show this just as well. If you use a calculator application, you are supplying data in the form of numbers and performing operations on these numbers in much the same way as you would do with piece of paper and a pencil — although a lot quicker!

If computer programs are fundamentally performing operations on data, then this implies that you need some way of storing that ...

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

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