O'Reilly logo

.NET Common Language Runtime Unleashed by Kevin Burton

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

Summary

When used properly, exceptions can add to an application's stability and robustness. The .NET Framework and the CLR have made exception handling mandatory, but at the same time, exceptions have never been easier to use and extend. In the interest of better exception and error handling, the following guidelines should prove beneficial:

  • Because it is so easy to handle and generate exceptions, great care should be taken to make sure you know when not to rely on exceptions. If, for example, an object can be tested for an invalid condition (such as null) to avoid having an exception raised, then do so. Suppose that you have an object that must be closed to free up the resources it was using, but closing an already closed object resulted in ...

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