O'Reilly logo

Learning C# 3.0 by Brian MacDonald, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Basic Debugging

Mistakes happen. It’s a simple fact of life, and it’s true in programming, too. Even the most experienced programmers make mistakes, sometimes the same mistakes over and over. You’ve probably made a few as you’ve gone through the exercises in this book. Mistakes are normal, and they are easy to make, especially in a programming language such as C#; we even have a special word for programming mistakes: bugs. You’ve probably noticed that the compiler (that’s Visual Studio or C# Express) catches a lot of your bugs, and tells you what’s wrong. It’s even right a lot of the time, although it’s certainly not perfect. The more you learn, and the more you have the basics of the language down, the more complicated your mistakes become. Staring at the code and puzzling it out isn’t an effective way to find bugs anymore. For that, you need a debugger. Fortunately, Visual Studio (including C# Express) comes with a great debugger built right in.

The debugger is your friend. There is simply no tool more powerful than a debugger for learning C# and for writing quality C# programs. Put simply, the debugger is a tool that helps you understand what is really going on when your program is running. It is the X-ray of software development, allowing you to see inside programs and diagnose potential problems.

Without a debugger, you are guessing; with a debugger, you are seeing. It is as simple as that. Whatever time you invest in learning to use your debugger is time well spent. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required