Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
All programming languages have to provide certain capabilities. It must be possible to express the calculations and operations that our code should perform. Programs need to be able to make decisions based on their input. Sometimes we will need to perform tasks repeatedly. These fundamental features are the very stuff of programming, and this chapter will show how these things work in C#.
Depending on your background, some of this chapter’s content may seem very familiar. C# is said to be from the “C family” of languages. C is a hugely influential programming language, and numerous languages have borrowed much of its syntax. There are direct descendants such as C++ and Objective-C. There are also more distantly related languages, including Java and JavaScript, that have no compatibility with, but still ape, many aspects of C’s syntax. If you are familiar with any of these languages, you will recognize most of the basic language features we are about to explore.