O'Reilly logo

Introducing Visual C# 2010 by Adam Freeman

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 14. Exceptions

Exceptions are the way that errors are handled in C#. If you have used C++ or Java, you will already be familiar with the idea of exceptions. In C#, all exceptions are runtime exceptions, meaning that methods do not have to declare the exceptions they will throw (for example, there is no equivalent to the Java throws keyword in method definitions). This can take a while to get used to, not least because any method you call can throw any kind of exception. Careful testing and a considered approach to handling runtime exceptions are essential in C# programs. In this chapter, I'll show you how to handle exceptions, throw exceptions, create custom exceptions, and aggregate multiple exceptions. Table 14-1 provides the summary ...

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