About this book
This book teaches C# through small console programs you can build, run, and change. It is written for beginning developers and students who want to understand the language before moving into web, desktop, mobile, or database applications. You do not need previous programming experience.
Start with the first four chapters to install the tools, create a program, and learn variables and types. The next chapters introduce decisions, loops, methods, and objects. Then you store groups of values in collections and search them with LINQ, the query feature built into C#. After that come error handling, asynchronous code (code that waits for slow work without freezing the program), tests, files, and a small database. The final part explains the newest language features once you have the foundation to use them.
Each chapter explains its prerequisites and shows where code belongs. Short code listings show one idea at a time. From Chapter 3 on, the Full Example near the end of each chapter is a complete program to run. Replace a file when the instructions tell you to replace it. Do not combine every listing into one program. The one program you keep is the Student Tracker, which most chapters from 3 to 22 extend.
On Windows, Visual Studio 2026 is the main development environment. Chapters 2 and 3 show how to create projects, find files, build, run, and debug. VS Code with C# Dev Kit is the alternative on Windows, macOS, and Linux; labeled instructions use the same code. Console applications keep the lessons focused on C# itself.
Work through the activities before looking at the separate activity solutions. Predict the output, run the program, and explain any difference. A program that builds without errors is a starting point. Running it and checking what it prints is how you learn whether it does what you intended. Use breakpoints and variable inspection to explain surprising results. Debugging practice starts in Chapter 3 and returns with arithmetic, loops, methods, objects, exceptions, and tests.
Download the companion code free at unqbd.com/go/cs9-code. It contains the complete examples and activity solutions for Chapters 3 to 26, and the Student Tracker after each chapter that changes it. The folders are named by chapter number: FullExamples/Chapter03 holds the complete example for Chapter 3, and ActivitySolutions/Chapter03 holds its activity solution. Chapter 2, Step 6 shows how to download the code and run any of them. Each project belongs to its chapter, so experiments in one lesson do not break another.
For classroom use, the chapters follow the same beginner progression as the previous edition. Instructors can choose activities that fit their course and use the final language chapters after students understand objects, collections, and pattern matching.
This book uses C# 15 and .NET 11. Before you run the example code, install the .NET 11 SDK, the free tools that build C# programs, as Chapter 2 shows. Optional experiments are identified separately from the required beginner material.
