C# 5.0 Programmer's Reference
When it comes to programming , a little learning can indeed be a dangerous thing. If you read a book like C# 5.0 All-in-One for Dummies (Bill Sempf et al., 2013, For Dummies) or my book Stephens’ C# Programming with Visual Studio 2010 24-Hour Trainer (Rod Stephens, 2010, Wrox), after only a few weeks you can easily think you know everything there is to know about programming. I clearly remember when I finished my first programming class. The language we used was UCSD
Pascal, and after only one class, I knew it quite well. I knew how to use the language, how to draw
simple graphics, and how to read and write files. I was quite sure that with enough work I could
write just about any program imaginable.
Since then I’ve had plenty of opportunities to realize just how wrong I was. I’ve worked on projects
in about a dozen different programming languages, each with its own strengths and idiosyncrasies.
I’ve worked on elegantly architected systems where adding new features was a breeze, and I’ve
worked on badly designed 50,000 plus line monstrosities where you might need to study the code for
a week before changing a single line for fear of breaking everything else. Since then I’ve also studied
complexity theory and learned that there are literally thousands of provably hard (NP-complete) programs
that you cannot solve in a reasonable amount of time. (I talk about some of them in my book
Essential Algorithms: A Practical Approach to Computer Algorithms, Rod Stephens, 2013, Wiley.)
Even by itself, C# is a complex and powerful programming language. It includes all the language features
that you would expect in any high-level language such as structures and classes, methods, complex
error handling (try, catch, and finally), branching statements (if-then and switch), several
kinds of loops (for, foreach, and while), and several ways to break out of loops (break and return).
In addition to the complexities of the language itself, C# provides many auxiliary features that make
it even more powerful and more complicated. Features let you execute query-like operations on arrays,
use parallel processing, serialize and deserialize objects, and let a program inspect pieces of code to
learn about the objects that it is using.
Finally, the environment that contains C# brings its own complexity. The .NET Framework contains
more than 10,000 classes that give you access to libraries for cryptography, expression matching,
interacting with the operating system, networking, and much more.
This book describes as much of that complexity as possible. It explains the pieces of the C# language
in detail. It explains the syntax, data types, and control statements that go into C# applications. This
book also describes some of the pieces of the .NET Framework that are most useful for building complex
This book does not cover every possible topic related to C#, but it does cover the majority of the
technologies that developers need to build sophisticated applications.