February 2010
Beginner
400 pages
11h 13m
English
Exception handling has been improved in .NET 4.0 with the introduction of the System.Runtime.ExceptionServices namespace, which contains classes for advanced exception handling.
Many developers have written code such as the following:
try
{
// do something that may fail
}
catch(System.Exception e)
{
...
}
(OK, I might have done this, too.) This is almost always a very naughty way to write code because all exceptions will be hidden. Hiding exceptions you don't know about is rarely a good thing, and if you do know about them, you should inevitably be handling them in a better way. Additionally, there are some exceptions that should never be caught (even by lazy developers), such as lowdown ...