Chapter 3: Variables and Expressions


Overview

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 data and some methods of manipulating it. These two functions are provided by variables and expressions, respectively, and in this chapter you will explore what this means both in general and specific terms.

Before you start with that, though, you should take a look at the basic syntax involved in C# programming, because you need a context within which to learn about and use variables and expressions in the C# language.




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

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