Chapter 4. Understanding C# Statements

This chapter concentrates on the basic building blocks C# provides you for writing programs. In this chapter, you will learn about the following:

  • Operators and operands

  • Expressions

  • Statements

  • lvalues and rvalues

  • What a symbol table is and how Visual Studio uses it

  • How Visual Studio interacts with Windows

  • The Bucket Analogy

  • Using the Visual Studio debugger

  • Magic numbers and why to avoid them

Most beginning books do not discuss many of the topics presented in this chapter. This may cause you to wonder why you need to understand them. There are several reasons. First, once you have mastered these topics, many of the other elements of C# (and programming in general) will become clearer and more intuitive. Memorizing certain rules is one approach to learning a language: once you've memorized (and obeyed) a rule, you can avoid some of the error messages that Visual Studio might throw at you. However, truly understanding why a rule exists in the first place is a vastly superior way to learn. It is this higher level of understanding that we seek. If you understand the material presented in this chapter, finding and correcting program errors becomes easier. Error detection becomes easier because you will have a deeper understanding of what C# is doing "under the hood." Finally, your knowledge of the material presented here will be portable. That is, the concepts and techniques discussed in this chapter apply to all programming languages, not just C#. If you ...

Get Beginning C# 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.